From: Sean E. <sea...@gm...> - 2006-11-21 04:52:38
|
I don't think I like this. Is there any way to get it back? -s. On 11/20/06, dat...@us... <dat...@us...> wrote: > Revision: 17799 > http://svn.sourceforge.net/gaim/?rev=17799&view=rev > Author: datallah > Date: 2006-11-20 20:34:38 -0800 (Mon, 20 Nov 2006) > > Log Message: > ----------- > The global buddy icon is now removable (via a right-click popup menu). > > Modified Paths: > -------------- > trunk/gtk/gtkstatusbox.c > trunk/gtk/gtkstatusbox.h > > Modified: trunk/gtk/gtkstatusbox.c > =================================================================== > --- trunk/gtk/gtkstatusbox.c 2006-11-21 02:27:31 UTC (rev 17798) > +++ trunk/gtk/gtkstatusbox.c 2006-11-21 04:34:38 UTC (rev 17799) > @@ -230,16 +230,45 @@ > status_menu_refresh_iter(status_box); > } > > +static void > +remove_buddy_icon_cb(GtkWidget *w, GtkGaimStatusBox *box) > +{ > + /* The pref-connect callback does the actual work */ > + gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", NULL); > + > + gtk_widget_destroy(box->icon_box_menu); > + box->icon_box_menu = NULL; > +} > + > static gboolean > icon_box_press_cb(GtkWidget *widget, GdkEventButton *event, GtkGaimStatusBox *box) > { > - if (box->buddy_icon_sel) { > - gtk_window_present(GTK_WINDOW(box->buddy_icon_sel)); > - return FALSE; > + if (event->button == 3) { > + GtkWidget *menu_item; > + > + if (box->icon_box_menu) > + gtk_widget_destroy(box->icon_box_menu); > + > + box->icon_box_menu = gtk_menu_new(); > + > + menu_item = gaim_new_item_from_stock(box->icon_box_menu, _("Remove"), GTK_STOCK_REMOVE, > + G_CALLBACK(remove_buddy_icon_cb), > + box, 0, 0, NULL); > + if (gaim_prefs_get_string("/gaim/gtk/accounts/buddyicon") == NULL) > + gtk_widget_set_sensitive(menu_item, FALSE); > + > + gtk_menu_popup(GTK_MENU(box->icon_box_menu), NULL, NULL, NULL, NULL, > + event->button, event->time); > + > + } else { > + if (box->buddy_icon_sel) { > + gtk_window_present(GTK_WINDOW(box->buddy_icon_sel)); > + return FALSE; > + } > + > + box->buddy_icon_sel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); > + gtk_widget_show_all(box->buddy_icon_sel); > } > - > - box->buddy_icon_sel = gaim_gtk_buddy_icon_chooser_new(NULL, icon_choose_cb, box); > - gtk_widget_show_all(box->buddy_icon_sel); > return FALSE; > } > > @@ -354,10 +383,14 @@ > if (statusbox->buddy_icon_sel) > gtk_widget_destroy(statusbox->buddy_icon_sel); > > + if (statusbox->icon_box_menu) > + gtk_widget_destroy(statusbox->icon_box_menu); > + > g_free(statusbox->buddy_icon_path); > > statusbox->icon = NULL; > statusbox->icon_box = NULL; > + statusbox->icon_box_menu = NULL; > statusbox->buddy_icon_path = NULL; > statusbox->buddy_icon = NULL; > statusbox->buddy_icon_hover = NULL; > @@ -1198,50 +1231,53 @@ > > box = data; > > - if (filename) { > + if (box->account) { > + GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); > + if (plug) { > + GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); > + if (prplinfo && prplinfo->icon_spec.format) { > + char *icon = NULL; > + if (filename) > + icon = gaim_gtk_convert_buddy_icon(plug, filename); > + gaim_account_set_ui_bool(box->account, GAIM_GTK_UI, "use-global-buddyicon", (filename != NULL)); > + gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon", icon); > + gaim_account_set_buddy_icon(box->account, icon); > + g_free(icon); > + } > + } > + } else { > GList *accounts; > - > - if (box->account) { > - GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(box->account)); > + for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) { > + GaimAccount *account = accounts->data; > + GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(account)); > if (plug) { > GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); > - if (prplinfo && prplinfo->icon_spec.format) { > - char *icon = gaim_gtk_convert_buddy_icon(plug, filename); > - gaim_account_set_buddy_icon(box->account, icon); > - gaim_account_set_ui_bool(box->account, GAIM_GTK_UI, "use-global-buddyicon", FALSE); > - gaim_account_set_ui_string(box->account, GAIM_GTK_UI, "non-global-buddyicon", icon); > + if (prplinfo != NULL && > + gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) && > + prplinfo->icon_spec.format) { > + char *icon = NULL; > + if (filename) > + icon = gaim_gtk_convert_buddy_icon(plug, filename); > + gaim_account_set_buddy_icon(account, icon); > g_free(icon); > } > } > - } else { > - for (accounts = gaim_accounts_get_all(); accounts != NULL; accounts = accounts->next) { > - GaimAccount *account = accounts->data; > - GaimPlugin *plug = gaim_find_prpl(gaim_account_get_protocol_id(account)); > - if (plug) { > - GaimPluginProtocolInfo *prplinfo = GAIM_PLUGIN_PROTOCOL_INFO(plug); > - if (prplinfo != NULL && > - gaim_account_get_ui_bool(account, GAIM_GTK_UI, "use-global-buddyicon", TRUE) && > - prplinfo->icon_spec.format) { > - char *icon = gaim_gtk_convert_buddy_icon(plug, filename); > - gaim_account_set_buddy_icon(account, icon); > - g_free(icon); > - } > - } > - } > } > - gtk_gaim_status_box_set_buddy_icon(box, filename); > } > + gtk_gaim_status_box_set_buddy_icon(box, filename); > } > > static void > icon_choose_cb(const char *filename, gpointer data) > { > GtkGaimStatusBox *box = data; > - if (box->account == NULL && filename) > - /* The pref-connect callback does the actual work */ > - gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); > - else > - buddy_icon_set_cb(filename, data); > + if (filename) { > + if (box->account == NULL) > + /* The pref-connect callback does the actual work */ > + gaim_prefs_set_string("/gaim/gtk/accounts/buddyicon", filename); > + else > + buddy_icon_set_cb(filename, data); > + } > > box->buddy_icon_sel = NULL; > } > > Modified: trunk/gtk/gtkstatusbox.h > =================================================================== > --- trunk/gtk/gtkstatusbox.h 2006-11-21 02:27:31 UTC (rev 17798) > +++ trunk/gtk/gtkstatusbox.h 2006-11-21 04:34:38 UTC (rev 17799) > @@ -94,6 +94,7 @@ > GtkWidget *buddy_icon_sel; > GtkWidget *icon; > GtkWidget *icon_box; > + GtkWidget *icon_box_menu; > GdkCursor *hand_cursor; > GdkCursor *arrow_cursor; > int icon_size; > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Gaim-commits mailing list > Gai...@li... > https://lists.sourceforge.net/lists/listinfo/gaim-commits > |