diff options
author | Gary Kramlich <grim@reaperworld.com> | 2022-05-27 03:05:57 -0500 |
---|---|---|
committer | Gary Kramlich <grim@reaperworld.com> | 2022-05-27 03:05:57 -0500 |
commit | 52e75e5119c8781d6863728b4165bd7813aad7db (patch) | |
tree | f38d435ce41261b784680e2a27a52a6b77366a2b | |
parent | f32f5562d0d34786656f8d5a154b79301b5b94f9 (diff) | |
download | pidgin-52e75e5119c8781d6863728b4165bd7813aad7db.tar.gz |
Remove a bunch of unused stuff in the gtkblist and set some sane defaults
Testing Done:
Ran and verified that the buddylist displayed all options by default now.
Reviewed at https://reviews.imfreedom.org/r/1445/
-rw-r--r-- | ChangeLog.API | 3 | ||||
-rw-r--r-- | doc/reference/pidgin/signals_gtkblist.md | 54 | ||||
-rw-r--r-- | pidgin/gtkblist.c | 208 | ||||
-rw-r--r-- | pidgin/gtkblist.h | 18 | ||||
-rw-r--r-- | pidgin/pidginactiongroup.c | 180 | ||||
-rw-r--r-- | pidgin/pidginactiongroup.h | 35 | ||||
-rw-r--r-- | pidgin/resources/BuddyList/window.ui | 50 |
7 files changed, 14 insertions, 534 deletions
diff --git a/ChangeLog.API b/ChangeLog.API index 32e6e6a62b..450b6ab3a1 100644 --- a/ChangeLog.API +++ b/ChangeLog.API @@ -802,9 +802,12 @@ version 3.0.0 (??/??/????): * conversation-dragging (gtkconv signal) * conversation-timestamp (gtkconv signal) * conversation-hiding (gtkconv signal) + * drawing-buddy (gtkblist signal) * GtkIMHtml.clipboard_html_string * GtkIMHtml.clipboard_text_string * GtkIMHtmlFontDetail + * gtkblist-hiding (gtkblist signal) + * gtkblist-unhiding (gtkblist signal) * gtk_imhtml_animation_free * gtk_imhtml_animation_new * gtk_imhtml_image_add_to diff --git a/doc/reference/pidgin/signals_gtkblist.md b/doc/reference/pidgin/signals_gtkblist.md index dca21bb35b..f22020d509 100644 --- a/doc/reference/pidgin/signals_gtkblist.md +++ b/doc/reference/pidgin/signals_gtkblist.md @@ -3,37 +3,6 @@ Slug: blist-signals ## Buddy List Signals -### gtkblist-hiding - -```c -void user_function(PurpleBuddyList *blist, gpointer user_data); -``` - -Emitted when the buddy list is about to be hidden. - -**Parameters:** - -**blist** -: The buddy list. - -**user_data** -: User data set when the signal handler was connected. - -### gtkblist-unhiding - -```c -void user_function(PurpleBuddyList *blist, gpointer user_data); -``` -Emitted when the buddy list is about to be unhidden. - -**Parameters:** - -**blist** -: The buddy list. - -**user_data** -: User data set when the signal handler was connected. - ### gtkblist-created ```c @@ -73,26 +42,3 @@ tooltip for a non-priority buddy. **user_data** : User data set when the signal handler was connected. - -### drawing-buddy - -```c -char *user_function(PurpleBuddy *buddy, gpointer user_data); -``` - -Emitted to allow plugins to handle markup within a buddy's name or to override -the default of no formatting for names shown in the buddy list. - -**Parameters:** - -**buddy** -: A pointer to the PupleBuddy that will be displayed. - -**user_data** -: User data set when the signal handler was connected. - -**Returns:** - -The text to display (must be allocated), or `NULL` if no changes to the default -behavior are desired. - diff --git a/pidgin/gtkblist.c b/pidgin/gtkblist.c index 2f2c56771b..bcabc7db9a 100644 --- a/pidgin/gtkblist.c +++ b/pidgin/gtkblist.c @@ -128,7 +128,6 @@ enum { EMBLEM_COLUMN, EMBLEM_VISIBLE_COLUMN, PROTOCOL_ICON_COLUMN, - PROTOCOL_ICON_VISIBLE_COLUMN, BLIST_COLUMNS }; @@ -231,20 +230,6 @@ static gboolean gtk_blist_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer d return TRUE; } -static void -gtk_blist_hide_cb(GtkWidget *widget, PidginBuddyList *gtkblist) -{ - purple_signal_emit(pidgin_blist_get_handle(), - "gtkblist-hiding", gtkblist); -} - -static void -gtk_blist_show_cb(GtkWidget *widget, PidginBuddyList *gtkblist) -{ - purple_signal_emit(pidgin_blist_get_handle(), - "gtkblist-unhiding", gtkblist); -} - static void gtk_blist_menu_info_cb(GtkWidget *w, PurpleBuddy *b) { PurpleAccount *account = purple_buddy_get_account(b); @@ -661,49 +646,6 @@ static void gtk_blist_menu_alias_cb(GtkWidget *w, PurpleBlistNode *node) gtk_tree_path_free(path); } -static void gtk_blist_menu_showoffline_cb(GtkWidget *w, PurpleBlistNode *node) -{ - if (PURPLE_IS_BUDDY(node)) - { - purple_blist_node_set_bool(node, "show_offline", - !purple_blist_node_get_bool(node, "show_offline")); - pidgin_blist_update(purple_blist_get_default(), node); - } - else if (PURPLE_IS_CONTACT(node)) - { - PurpleBlistNode *bnode; - gboolean setting = !purple_blist_node_get_bool(node, "show_offline"); - - purple_blist_node_set_bool(node, "show_offline", setting); - for (bnode = purple_blist_node_get_first_child(node); - bnode != NULL; - bnode = purple_blist_node_get_sibling_next(bnode)) - { - purple_blist_node_set_bool(bnode, "show_offline", setting); - pidgin_blist_update(purple_blist_get_default(), bnode); - } - } else if (PURPLE_IS_GROUP(node)) { - PurpleBlistNode *cnode, *bnode; - gboolean setting = !purple_blist_node_get_bool(node, "show_offline"); - - purple_blist_node_set_bool(node, "show_offline", setting); - for (cnode = purple_blist_node_get_first_child(node); - cnode != NULL; - cnode = purple_blist_node_get_sibling_next(cnode)) - { - purple_blist_node_set_bool(cnode, "show_offline", setting); - for (bnode = purple_blist_node_get_first_child(cnode); - bnode != NULL; - bnode = purple_blist_node_get_sibling_next(bnode)) - { - purple_blist_node_set_bool(bnode, "show_offline", setting); - pidgin_blist_update(purple_blist_get_default(), - bnode); - } - } - } -} - static void do_join_chat(PidginChatData *data) { @@ -1456,13 +1398,6 @@ pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub) } } - if (!purple_blist_node_is_transient(node)) { - gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); - pidgin_new_menu_item(menu, - show_offline ? _("Hide When Offline") : _("Show When Offline"), - NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node); - } - pidgin_append_blist_node_proto_menu(menu, purple_account_get_connection(purple_buddy_get_account(buddy)), node); pidgin_append_blist_node_extended_menu(menu, node); @@ -1638,12 +1573,6 @@ create_group_menu (PurpleBlistNode *node, PurpleGroup *g) G_CALLBACK(pidgin_blist_remove_cb), node); pidgin_new_menu_item(menu, _("_Rename"), NULL, G_CALLBACK(gtk_blist_menu_alias_cb), node); - if (!purple_blist_node_is_transient(node)) { - gboolean show_offline = purple_blist_node_get_bool(node, "show_offline"); - pidgin_new_menu_item(menu, - show_offline ? _("Hide When Offline") : _("Show When Offline"), - NULL, G_CALLBACK(gtk_blist_menu_showoffline_cb), node); - } add_buddy_icon_menu_items(menu, node); @@ -1718,7 +1647,6 @@ create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) PidginBlistNode *gtknode = g_object_get_data(G_OBJECT(node), UI_DATA); GtkWidget *menu; GtkWidget *menuitem; - gboolean show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); menu = gtk_menu_new(); pidgin_blist_make_buddy_menu(menu, b, FALSE); @@ -1750,8 +1678,6 @@ create_buddy_menu(PurpleBlistNode *node, PurpleBuddy *b) continue; if(!purple_account_get_connection(purple_buddy_get_account(buddy))) continue; - if(!show_offline && !PURPLE_BUDDY_IS_ONLINE(buddy)) - continue; menuitem = gtk_menu_item_new_with_label(purple_buddy_get_name(buddy)); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); @@ -2082,18 +2008,10 @@ static GdkPixbuf *pidgin_blist_get_buddy_icon(PurpleBlistNode *node, static gboolean buddy_is_displayable(PurpleBuddy *buddy) { - PidginBlistNode *gtknode; - if(!buddy) return FALSE; - gtknode = g_object_get_data(G_OBJECT(buddy), UI_DATA); - - return (purple_account_is_connected(purple_buddy_get_account(buddy)) && - (purple_presence_is_online(purple_buddy_get_presence(buddy)) || - (gtknode && gtknode->recent_signonoff) || - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies") || - purple_blist_node_get_bool(PURPLE_BLIST_NODE(buddy), "show_offline"))); + return purple_account_is_connected(purple_buddy_get_account(buddy)); } /* # - Status Icon @@ -2699,9 +2617,7 @@ pidgin_blist_get_emblem(PurpleBlistNode *node) pidgin_node = g_object_get_data(G_OBJECT(node->parent), UI_DATA); if(pidgin_node->contact_expanded) { - if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) - return NULL; - return pidgin_create_protocol_icon(purple_buddy_get_account((PurpleBuddy*)node), PIDGIN_PROTOCOL_ICON_SMALL); + return NULL; } } else { return NULL; @@ -2889,12 +2805,7 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased else name = purple_buddy_get_alias(b); - /* Raise a contact pre-draw signal here. THe callback will return an - * escaped version of the name. */ - nametext = purple_signal_emit_return_1(pidgin_blist_get_handle(), "drawing-buddy", b); - - if(!nametext) - nametext = g_markup_escape_text(name, strlen(name)); + nametext = g_markup_escape_text(name, strlen(name)); presence = purple_buddy_get_presence(b); @@ -2927,7 +2838,7 @@ pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased statustext = g_strdup(_("Offline")); /* Idle Text */ - if (purple_presence_is_idle(presence) && purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")) { + if (purple_presence_is_idle(presence)) { time_t idle_secs = purple_presence_get_idle_time(presence); if (idle_secs > 0) { @@ -3178,38 +3089,6 @@ void pidgin_blist_setup_sort_methods() pidgin_blist_sort_method_set(id); } -static void _prefs_change_redo_list(const char *name, PurplePrefType type, - gconstpointer val, gpointer data) -{ - GtkTreeSelection *sel; - GtkTreeIter iter; - PurpleBlistNode *node = NULL; - - sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkblist->treeview)); - if (gtk_tree_selection_get_selected(sel, NULL, &iter)) - { - gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter, NODE_COLUMN, &node, -1); - } - - redo_buddy_list(purple_blist_get_default(), FALSE, FALSE); - gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); - - if (node) - { - PidginBlistNode *gtknode; - GtkTreePath *path; - - gtknode = g_object_get_data(G_OBJECT(node), UI_DATA); - if (gtknode && gtknode->row) - { - path = gtk_tree_row_reference_get_path(gtknode->row); - gtk_tree_selection_select_path(sel, path); - gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(gtkblist->treeview), path, NULL, FALSE, 0, 0); - gtk_tree_path_free(path); - } - } -} - static void _prefs_change_sort_method(const char *pref_name, PurplePrefType type, gconstpointer val, gpointer data) { @@ -3809,7 +3688,6 @@ pidgin_blist_build_layout(PurpleBuddyList *list) gtk_tree_view_column_pack_start(column, rend, FALSE); gtk_tree_view_column_set_attributes(column, rend, "pixbuf", PROTOCOL_ICON_COLUMN, - "visible", PROTOCOL_ICON_VISIBLE_COLUMN, NULL); g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL); @@ -3896,10 +3774,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) gtkblist->vbox = pidgin_contact_list_get_vbox(PIDGIN_CONTACT_LIST(gtkblist->window)); g_signal_connect(G_OBJECT(gtkblist->window), "delete_event", G_CALLBACK(gtk_blist_delete_cb), NULL); - g_signal_connect(G_OBJECT(gtkblist->window), "hide", - G_CALLBACK(gtk_blist_hide_cb), gtkblist); - g_signal_connect(G_OBJECT(gtkblist->window), "show", - G_CALLBACK(gtk_blist_show_cb), gtkblist); g_signal_connect(G_OBJECT(gtkblist->window), "visibility_notify_event", G_CALLBACK(gtk_blist_visibility_cb), NULL); g_signal_connect(G_OBJECT(gtkblist->window), "window_state_event", G_CALLBACK(gtk_blist_window_state_cb), NULL); gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK); @@ -3917,8 +3791,7 @@ static void pidgin_blist_show(PurpleBuddyList *list) G_TYPE_BOOLEAN, /* Contact expander visible */ GDK_TYPE_PIXBUF, /* Emblem */ G_TYPE_BOOLEAN, /* Emblem visible */ - GDK_TYPE_PIXBUF, /* Protocol icon */ - G_TYPE_BOOLEAN /* Protocol visible */ + GDK_TYPE_PIXBUF /* Protocol icon */ ); gtkblist->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(gtkblist->treemodel)); @@ -3993,16 +3866,6 @@ static void pidgin_blist_show(PurpleBuddyList *list) handle = pidgin_blist_get_handle(); - /* things that affect how buddies are displayed */ - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_idle_time", - _prefs_change_redo_list, NULL); - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_empty_groups", - _prefs_change_redo_list, NULL); - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", - _prefs_change_redo_list, NULL); - purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", - _prefs_change_redo_list, NULL); - /* sorting */ purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/sort_type", _prefs_change_sort_method, NULL); @@ -4213,34 +4076,14 @@ static gboolean insert_node(PurpleBuddyList *list, PurpleBlistNode *node, GtkTre return TRUE; } -static gboolean pidgin_blist_group_has_show_offline_buddy(PurpleGroup *group) -{ - PurpleBlistNode *gnode, *cnode, *bnode; - - gnode = PURPLE_BLIST_NODE(group); - for(cnode = gnode->child; cnode; cnode = cnode->next) { - if(PURPLE_IS_CONTACT(cnode)) { - for(bnode = cnode->child; bnode; bnode = bnode->next) { - PurpleBuddy *buddy = (PurpleBuddy *)bnode; - if (purple_account_is_connected(purple_buddy_get_account(buddy)) && - purple_blist_node_get_bool(bnode, "show_offline")) - return TRUE; - } - } - } - return FALSE; -} - /* This version of pidgin_blist_update_group can take the original buddy or a * group, but has much better algorithmic performance with a pre-known buddy. */ static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node) { - gint count; - PurpleGroup *group; PurpleBlistNode* gnode; - gboolean show = FALSE, show_offline = FALSE; + gboolean show = FALSE; g_return_if_fail(node != NULL); @@ -4256,22 +4099,7 @@ static void pidgin_blist_update_group(PurpleBuddyList *list, else return; - group = (PurpleGroup*)gnode; - - show_offline = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); - - if(show_offline) - count = purple_counting_node_get_current_size(PURPLE_COUNTING_NODE(group)); - else - count = purple_counting_node_get_online_count(PURPLE_COUNTING_NODE(group)); - - if (count > 0 || purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")) - show = TRUE; - else if (PURPLE_IS_BUDDY(node) && buddy_is_displayable((PurpleBuddy*)node)) { /* Or chat? */ - show = TRUE; - } else if (!show_offline) { - show = pidgin_blist_group_has_show_offline_buddy(group); - } + show = TRUE; if (show) { gchar *title; @@ -4378,7 +4206,6 @@ static void buddy_node(PurpleBuddy *buddy, GtkTreeIter *iter, PurpleBlistNode *n EMBLEM_COLUMN, emblem, EMBLEM_VISIBLE_COLUMN, (emblem != NULL), PROTOCOL_ICON_COLUMN, protocol_icon, - PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), CONTACT_EXPANDER_COLUMN, NULL, CONTACT_EXPANDER_VISIBLE_COLUMN, pidgin_node->contact_expanded, GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, @@ -4547,7 +4374,6 @@ static void pidgin_blist_update_chat(PurpleBuddyList *list, PurpleBlistNode *nod EMBLEM_COLUMN, emblem, EMBLEM_VISIBLE_COLUMN, emblem != NULL, PROTOCOL_ICON_COLUMN, protocol_icon, - PROTOCOL_ICON_VISIBLE_COLUMN, purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"), NAME_COLUMN, mark, GROUP_EXPANDER_VISIBLE_COLUMN, FALSE, -1); @@ -5108,27 +4934,19 @@ void pidgin_blist_init(void) /* Remove old prefs */ purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_empty_groups"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_idle_time"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies"); + purple_prefs_remove(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons"); /* Initialize prefs */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/blist"); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", FALSE); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", TRUE); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", FALSE); - purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_visible", FALSE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/blist/list_maximized", FALSE); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/sort_type", "alphabetical"); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/theme", ""); /* Register our signals */ - purple_signal_register(gtk_blist_handle, "gtkblist-hiding", - purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, - PURPLE_TYPE_BUDDY_LIST); - - purple_signal_register(gtk_blist_handle, "gtkblist-unhiding", - purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, - PURPLE_TYPE_BUDDY_LIST); - purple_signal_register(gtk_blist_handle, "gtkblist-created", purple_marshal_VOID__POINTER, G_TYPE_NONE, 1, PURPLE_TYPE_BUDDY_LIST); @@ -5139,10 +4957,6 @@ void pidgin_blist_init(void) G_TYPE_POINTER, /* pointer to a (GString *) */ G_TYPE_BOOLEAN); - purple_signal_register(gtk_blist_handle, "drawing-buddy", - purple_marshal_POINTER__POINTER, - G_TYPE_STRING, 1, PURPLE_TYPE_BUDDY); - purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", gtk_blist_handle, G_CALLBACK(buddy_signonoff_cb), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", diff --git a/pidgin/gtkblist.h b/pidgin/gtkblist.h index 6bb894a6e4..55a57af54c 100644 --- a/pidgin/gtkblist.h +++ b/pidgin/gtkblist.h @@ -45,9 +45,6 @@ typedef enum { **************************************************************************/ /** * PidginBuddyList: - * @notebook: The notebook that switches between the real buddy list - * and the helpful instructions page - * @main_vbox: This vbox contains the menu and notebook * @vbox: This is the vbox that everything important gets packed * into. Your plugin might want to pack something in it * itself. Go, plugins! @@ -55,20 +52,8 @@ typedef enum { * @treemodel: This is the treemodel. * @text_column: Column * @refresh_timer: The timer for refreshing every 30 seconds - * @contact_rect: This is the bounding rectangle of the contact node and - * its children. This is used for auto-expand on mouseover. - * @mouseover_contact: This is the contact currently mouse-over expanded * @selected_node: The currently selected node * @scrollbook: Scrollbook for alerts - * @headline: Widget for headline notifications - * @headline_label: Label for headline notifications - * @headline_image: Image for headline notifications - * @headline_callback: Callback for headline notifications - * @headline_data: User data for headline notifications - * @headline_destroy: Callback to use for destroying the headline-data - * @statusbox: The status selector dropdown - * @empty_avatar: A 32x32 transparent pixbuf - * @priv: Pointer to opaque private data * * Like, everything you need to know about the gtk buddy list */ @@ -88,9 +73,6 @@ struct _PidginBuddyList { guint refresh_timer; - GdkRectangle contact_rect; - PurpleBlistNode *mouseover_contact; - PurpleBlistNode *selected_node; GtkWidget *scrollbook; diff --git a/pidgin/pidginactiongroup.c b/pidgin/pidginactiongroup.c index ffa0b7033d..a15a27af8e 100644 --- a/pidgin/pidginactiongroup.c +++ b/pidgin/pidginactiongroup.c @@ -35,70 +35,6 @@ struct _PidginActionGroup { *****************************************************************************/ /*< private > - * pidgin_action_group_bool_pref_handler: - * @group: The #PidginActionGroup instance. - * @action_name: The name of the action to update. - * @value: The value of the preference. - * - * Changes the state of the action named @action_name to match @value. - * - * This function is meant to be called from a #PurplePrefCallback function as - * there isn't a good way to have a #PurplePrefCallback with multiple items in - * the data parameter without leaking them forever. - */ -static void -pidgin_action_group_bool_pref_handler(PidginActionGroup *group, - const gchar *action_name, - gboolean value) -{ - GAction *action = NULL; - - action = g_action_map_lookup_action(G_ACTION_MAP(group), action_name); - if(action != NULL) { - g_simple_action_set_state(G_SIMPLE_ACTION(action), - g_variant_new_boolean(value)); - } -} - -/*< private > - * pidgin_action_group_setup_bool: - * @group: The #PidginActionGroup instance. - * @action_name: The name of the action to setup. - * @pref_name: The name of the preference that @action_name is tied to. - * @callback: (scope notified): A #PurplePrefCallback to call when the - * preference is changed. - * - * Initializes the boolean action named @action_name to the value of @pref_name - * and setups up a preference change callback to @callback to maintain the - * state of the action. - */ -static void -pidgin_action_group_setup_bool(PidginActionGroup *group, - const gchar *action_name, - const gchar *pref_name, - PurplePrefCallback callback) -{ - GAction *action = NULL; - gboolean value = FALSE; - - /* find the action, if we can't find it, bail */ - action = g_action_map_lookup_action(G_ACTION_MAP(group), action_name); - g_return_if_fail(action != NULL); - - /* get the value of the preference */ - value = purple_prefs_get_bool(pref_name); - - /* change the state of the action to match the preference value. */ - g_simple_action_set_state(G_SIMPLE_ACTION(action), - g_variant_new_boolean(value)); - - /* finally add a preference callback to update the state based on the - * preference. - */ - purple_prefs_connect_callback(group, pref_name, callback, group); -} - -/*< private > * pidgin_action_group_string_pref_handler: * @group: The #PidginActionGroup instance. * @action_name: The name of the action to update. @@ -164,58 +100,6 @@ pidgin_action_group_setup_string(PidginActionGroup *group, * Preference Callbacks *****************************************************************************/ static void -pidgin_action_group_show_empty_groups_callback(const gchar *name, - PurplePrefType type, - gconstpointer value, - gpointer data) -{ - PidginActionGroup *group = PIDGIN_ACTION_GROUP(data); - - pidgin_action_group_bool_pref_handler(group, - PIDGIN_ACTION_SHOW_EMPTY_GROUPS, - (gboolean)GPOINTER_TO_INT(value)); -} - -static void -pidgin_action_group_show_idle_times_callback(const gchar *name, - PurplePrefType type, - gconstpointer value, - gpointer data) -{ - PidginActionGroup *group = PIDGIN_ACTION_GROUP(data); - - pidgin_action_group_bool_pref_handler(group, - PIDGIN_ACTION_SHOW_IDLE_TIMES, - (gboolean)GPOINTER_TO_INT(value)); -} - -static void -pidgin_action_group_show_offline_buddies_callback(const gchar *name, - PurplePrefType type, - gconstpointer value, - gpointer data) -{ - PidginActionGroup *group = PIDGIN_ACTION_GROUP(data); - - pidgin_action_group_bool_pref_handler(group, - PIDGIN_ACTION_SHOW_OFFLINE_BUDDIES, - (gboolean)GPOINTER_TO_INT(value)); -} - -static void -pidgin_action_group_show_protocol_icons_callback(const gchar *name, - PurplePrefType type, - gconstpointer value, - gpointer data) -{ - PidginActionGroup *group = PIDGIN_ACTION_GROUP(data); - - pidgin_action_group_bool_pref_handler(group, - PIDGIN_ACTION_SHOW_PROTOCOL_ICONS, - (gboolean)GPOINTER_TO_INT(value)); -} - -static void pidgin_action_group_sort_method_callback(const gchar *name, PurplePrefType type, gconstpointer value, @@ -232,41 +116,6 @@ pidgin_action_group_sort_method_callback(const gchar *name, * Action Callbacks *****************************************************************************/ static void -pidgin_action_group_show_empty_groups(GSimpleAction *action, GVariant *value, - gpointer data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", - g_variant_get_boolean(value)); -} - -static void -pidgin_action_group_show_idle_times(GSimpleAction *action, - GVariant *value, - gpointer data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", - g_variant_get_boolean(value)); -} - -static void -pidgin_action_group_show_offline_buddies(GSimpleAction *action, - GVariant *value, - gpointer data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", - g_variant_get_boolean(value)); -} - -static void -pidgin_action_group_show_protocol_icons(GSimpleAction *action, - GVariant *value, - gpointer data) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", - g_variant_get_boolean(value)); -} - -static void pidgin_action_group_sort_method(GSimpleAction *action, GVariant *value, gpointer data) { @@ -284,22 +133,6 @@ static void pidgin_action_group_init(PidginActionGroup *group) { GActionEntry entries[] = { { - .name = PIDGIN_ACTION_SHOW_EMPTY_GROUPS, - .state = "false", - .change_state = pidgin_action_group_show_empty_groups, - }, { - .name = PIDGIN_ACTION_SHOW_IDLE_TIMES, - .state = "false", - .change_state = pidgin_action_group_show_idle_times, - }, { - .name = PIDGIN_ACTION_SHOW_OFFLINE_BUDDIES, - .state = "false", - .change_state = pidgin_action_group_show_offline_buddies, - }, { - .name = PIDGIN_ACTION_SHOW_PROTOCOL_ICONS, - .state = "false", - .change_state = pidgin_action_group_show_protocol_icons, - }, { .name = PIDGIN_ACTION_SORT_METHOD, .parameter_type = "s", .state = "'none'", @@ -313,19 +146,6 @@ pidgin_action_group_init(PidginActionGroup *group) { /* now add some handlers for preference changes and set actions to the * correct value. */ - pidgin_action_group_setup_bool(group, PIDGIN_ACTION_SHOW_EMPTY_GROUPS, - PIDGIN_PREFS_ROOT "/blist/show_empty_groups", - pidgin_action_group_show_empty_groups_callback); - pidgin_action_group_setup_bool(group, PIDGIN_ACTION_SHOW_IDLE_TIMES, - PIDGIN_PREFS_ROOT "/blist/show_idle_time", - pidgin_action_group_show_idle_times_callback); - pidgin_action_group_setup_bool(group, PIDGIN_ACTION_SHOW_OFFLINE_BUDDIES, - PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", - pidgin_action_group_show_offline_buddies_callback); - pidgin_action_group_setup_bool(group, PIDGIN_ACTION_SHOW_PROTOCOL_ICONS, - PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", - pidgin_action_group_show_protocol_icons_callback); - pidgin_action_group_setup_string(group, PIDGIN_ACTION_SORT_METHOD, PIDGIN_PREFS_ROOT "/blist/sort_type", pidgin_action_group_sort_method_callback); diff --git a/pidgin/pidginactiongroup.h b/pidgin/pidginactiongroup.h index b6817ec59b..cb2fde1bc0 100644 --- a/pidgin/pidginactiongroup.h +++ b/pidgin/pidginactiongroup.h @@ -42,41 +42,6 @@ */ /** - * PIDGIN_ACTION_SHOW_BUDDY_ICONS: - * - * A constant that represents the show-buddy-icons action. - */ -#define PIDGIN_ACTION_SHOW_BUDDY_ICONS ("show-buddy-icons") - -/** - * PIDGIN_ACTION_SHOW_EMPTY_GROUPS: - * - * A constant that represents the show-empty-groups action. - */ -#define PIDGIN_ACTION_SHOW_EMPTY_GROUPS ("show-empty-groups") - -/** - * PIDGIN_ACTION_SHOW_IDLE_TIMES: - * - * A constant that represents the show-idle-times action. - */ -#define PIDGIN_ACTION_SHOW_IDLE_TIMES ("show-idle-times") - -/** - * PIDGIN_ACTION_SHOW_OFFLINE_BUDDIES: - * - * A constant that represents the show-offline-buddies action. - */ -#define PIDGIN_ACTION_SHOW_OFFLINE_BUDDIES ("show-offline-buddies") - -/** - * PIDGIN_ACTION_SHOW_PROTOCOL_ICONS: - * - * A constant that represents the show-protocol-icons action. - */ -#define PIDGIN_ACTION_SHOW_PROTOCOL_ICONS ("show-protocol-icons") - -/** * PIDGIN_ACTION_SORT_METHOD: * * A constant that represents the sort-method action to change the sorting diff --git a/pidgin/resources/BuddyList/window.ui b/pidgin/resources/BuddyList/window.ui index 144236668a..2bc890d59f 100644 --- a/pidgin/resources/BuddyList/window.ui +++ b/pidgin/resources/BuddyList/window.ui @@ -50,56 +50,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. <property name="visible">True</property> <property name="can-focus">False</property> <child> - <object class="GtkMenuItem"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Sh_ow</property> - <property name="use-underline">True</property> - <child type="submenu"> - <object class="GtkMenu"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <object class="GtkCheckMenuItem" id="show_offline_buddies"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="action-name">blist.show-offline-buddies</property> - <property name="label" translatable="yes">_Offline Buddies</property> - <property name="use-underline">True</property> - </object> - </child> - <child> - <object class="GtkCheckMenuItem" id="show_empty_groups"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="action-name">blist.show-empty-groups</property> - <property name="label" translatable="yes">_Empty Groups</property> - <property name="use-underline">True</property> - </object> - </child> - <child> - <object class="GtkCheckMenuItem" id="show_idle_times"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="action-name">blist.show-idle-times</property> - <property name="label" translatable="yes">Idle _Times</property> - <property name="use-underline">True</property> - </object> - </child> - <child> - <object class="GtkCheckMenuItem" id="show_protocol_icons"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="action-name">blist.show-protocol-icons</property> - <property name="label" translatable="yes">_Protocol Icons</property> - <property name="use-underline">True</property> - </object> - </child> - </object> - </child> - </object> - </child> - <child> <object class="GtkMenuItem" id="sort_buddies"> <property name="visible">True</property> <property name="can-focus">False</property> |