Mercurial > pidgin
comparison src/applet.c @ 1689:09017c023fcd
[gaim-migrate @ 1699]
do i really want it like this?
committer: Tailor Script <tailor@pidgin.im>
| author | Eric Warmenhoven <eric@warmenhoven.org> |
|---|---|
| date | Sat, 07 Apr 2001 07:57:14 +0000 |
| parents | 5c74d8b6cb57 |
| children | f15d449b3167 |
comparison
equal
deleted
inserted
replaced
| 1688:85d8c64e969d | 1689:09017c023fcd |
|---|---|
| 41 gboolean applet_buddy_show = FALSE; | 41 gboolean applet_buddy_show = FALSE; |
| 42 GtkWidget *applet_popup = NULL; | 42 GtkWidget *applet_popup = NULL; |
| 43 | 43 |
| 44 GtkWidget *applet; | 44 GtkWidget *applet; |
| 45 GtkWidget *appletframe; | 45 GtkWidget *appletframe; |
| 46 GtkWidget *status_label; | |
| 47 | 46 |
| 48 GtkWidget *icon; | 47 GtkWidget *icon; |
| 49 GdkPixmap *icon_offline_pm=NULL; | 48 GdkPixmap *icon_offline_pm=NULL; |
| 50 GdkPixmap *icon_offline_bm=NULL; | 49 GdkPixmap *icon_offline_bm=NULL; |
| 51 | 50 |
| 107 | 106 |
| 108 if (connecting) { | 107 if (connecting) { |
| 109 gtk_pixmap_set( GTK_PIXMAP(icon), | 108 gtk_pixmap_set( GTK_PIXMAP(icon), |
| 110 icon_connect_pm, | 109 icon_connect_pm, |
| 111 icon_connect_bm ); | 110 icon_connect_bm ); |
| 112 gtk_label_set( GTK_LABEL(status_label), _MSG_CONNECT_ ); | |
| 113 applet_set_tooltips(_("Attempting to sign on....")); | 111 applet_set_tooltips(_("Attempting to sign on....")); |
| 114 } else if (!connections) { | 112 } else if (!connections) { |
| 115 gtk_pixmap_set( GTK_PIXMAP(icon), | 113 gtk_pixmap_set( GTK_PIXMAP(icon), |
| 116 icon_offline_pm, | 114 icon_offline_pm, |
| 117 icon_offline_bm ); | 115 icon_offline_bm ); |
| 118 gtk_label_set( GTK_LABEL(status_label), _MSG_OFFLINE_ ); | |
| 119 applet_set_tooltips(_("Offilne. Click to bring up login box.")); | 116 applet_set_tooltips(_("Offilne. Click to bring up login box.")); |
| 120 } else if (!awaymessage) { | 117 } else if (!awaymessage) { |
| 121 gtk_pixmap_set( GTK_PIXMAP(icon), | 118 gtk_pixmap_set( GTK_PIXMAP(icon), |
| 122 icon_online_pm, | 119 icon_online_pm, |
| 123 icon_online_bm ); | 120 icon_online_bm ); |
| 124 gtk_label_set( GTK_LABEL(status_label), _MSG_ONLINE_ ); | |
| 125 g_snprintf(buf, sizeof buf, "Online: "); | 121 g_snprintf(buf, sizeof buf, "Online: "); |
| 126 while (c) { | 122 while (c) { |
| 127 strcat(buf, ((struct gaim_connection *)c->data)->username); | 123 strcat(buf, ((struct gaim_connection *)c->data)->username); |
| 128 c = g_slist_next(c); | 124 c = g_slist_next(c); |
| 129 if (c) strcat(buf, ", "); | 125 if (c) strcat(buf, ", "); |
| 131 applet_set_tooltips(buf); | 127 applet_set_tooltips(buf); |
| 132 } else { | 128 } else { |
| 133 gtk_pixmap_set( GTK_PIXMAP(icon), | 129 gtk_pixmap_set( GTK_PIXMAP(icon), |
| 134 icon_online_pm, | 130 icon_online_pm, |
| 135 icon_online_bm ); | 131 icon_online_bm ); |
| 136 gtk_label_set( GTK_LABEL(status_label), _("Away") ); | |
| 137 } | 132 } |
| 138 | 133 |
| 139 return TRUE; | 134 return TRUE; |
| 140 } | 135 } |
| 141 | 136 |
| 142 void update_pixmaps() { | 137 void update_pixmaps() { |
| 143 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, (sizehint-16), (sizehint-12), | 138 load_applet_icon( GAIM_GNOME_OFFLINE_ICON, (sizehint-1), (sizehint-1), |
| 144 &icon_offline_pm, &icon_offline_bm ); | 139 &icon_offline_pm, &icon_offline_bm ); |
| 145 load_applet_icon( GAIM_GNOME_CONNECT_ICON, (sizehint-16), (sizehint-12), | 140 load_applet_icon( GAIM_GNOME_CONNECT_ICON, (sizehint-1), (sizehint-1), |
| 146 &icon_connect_pm, &icon_connect_bm ); | 141 &icon_connect_pm, &icon_connect_bm ); |
| 147 load_applet_icon( GAIM_GNOME_ONLINE_ICON, (sizehint-16), (sizehint-12), | 142 load_applet_icon( GAIM_GNOME_ONLINE_ICON, (sizehint-1), (sizehint-1), |
| 148 &icon_online_pm, &icon_online_bm ); | 143 &icon_online_pm, &icon_online_bm ); |
| 149 update_applet(); | 144 update_applet(); |
| 150 gtk_widget_set_usize(appletframe, sizehint, sizehint); | 145 gtk_widget_set_usize(appletframe, sizehint, sizehint); |
| 151 } | 146 } |
| 152 | 147 |
| 317 if(!applet) g_error(_("Can't create GAIM applet!")); | 312 if(!applet) g_error(_("Can't create GAIM applet!")); |
| 318 gtk_widget_set_events(applet, gtk_widget_get_events(applet) | | 313 gtk_widget_set_events(applet, gtk_widget_get_events(applet) | |
| 319 GDK_BUTTON_PRESS_MASK); | 314 GDK_BUTTON_PRESS_MASK); |
| 320 | 315 |
| 321 appletframe = gtk_frame_new(NULL); | 316 appletframe = gtk_frame_new(NULL); |
| 317 gtk_frame_set_shadow_type(GTK_FRAME(appletframe), GTK_SHADOW_NONE); | |
| 322 #ifdef HAVE_PANEL_PIXEL_SIZE | 318 #ifdef HAVE_PANEL_PIXEL_SIZE |
| 323 gtk_widget_set_usize(appletframe, 5, 5); | 319 gtk_widget_set_usize(appletframe, 5, 5); |
| 324 #else | 320 #else |
| 325 gtk_widget_set_usize(appletframe, 48, 48); | 321 gtk_widget_set_usize(appletframe, 48, 48); |
| 326 #endif | 322 #endif |
| 343 | 339 |
| 344 vbox = gtk_vbox_new(FALSE,0); | 340 vbox = gtk_vbox_new(FALSE,0); |
| 345 | 341 |
| 346 gtk_box_pack_start(GTK_BOX(vbox), icon, FALSE, TRUE, 0); | 342 gtk_box_pack_start(GTK_BOX(vbox), icon, FALSE, TRUE, 0); |
| 347 | 343 |
| 348 status_label = gtk_label_new(_("Offline")); | |
| 349 | |
| 350 update_applet(); | 344 update_applet(); |
| 351 | |
| 352 /*set this label's font*/ | |
| 353 label_style = gtk_widget_get_style( status_label ); | |
| 354 | |
| 355 label_font = gdk_font_load( _MSG_FONT_ ); | |
| 356 | |
| 357 | |
| 358 if( label_font != NULL ){ | |
| 359 label_style->font = label_font; | |
| 360 gtk_widget_set_style( status_label, label_style ); | |
| 361 } else { | |
| 362 debug_printf(_("Font does not exist") ); | |
| 363 } | |
| 364 | |
| 365 gtk_box_pack_start(GTK_BOX(vbox), status_label, FALSE, TRUE, 0); | |
| 366 | 345 |
| 367 gtk_container_add( GTK_CONTAINER(appletframe), vbox ); | 346 gtk_container_add( GTK_CONTAINER(appletframe), vbox ); |
| 368 applet_widget_add(APPLET_WIDGET(applet), appletframe); | 347 applet_widget_add(APPLET_WIDGET(applet), appletframe); |
| 369 | 348 |
| 370 gtk_widget_show( status_label ); | |
| 371 gtk_widget_show( vbox ); | 349 gtk_widget_show( vbox ); |
| 372 gtk_widget_show( appletframe ); | 350 gtk_widget_show( appletframe ); |
| 373 | 351 |
| 374 applet_widget_register_stock_callback(APPLET_WIDGET(applet), | 352 applet_widget_register_stock_callback(APPLET_WIDGET(applet), |
| 375 "about", | 353 "about", |
