Mercurial > pidgin
changeset 32620:82f26939d2ba
Remove all the old GTK_CHECK_VERSION stuff. Of course, this makes this
branch strictly 3.0.0 only.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 26 Jul 2010 04:14:44 +0000 |
parents | 6e9c4f45595c |
children | 673c545af5b0 |
files | pidgin/gtkblist.c pidgin/gtkblist.h pidgin/gtkconv.c pidgin/gtkconvwin.h pidgin/gtkdocklet.c pidgin/gtkmedia.c pidgin/gtkutils.c pidgin/gtkutils.h |
diffstat | 8 files changed, 78 insertions(+), 1020 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkblist.c Mon Jul 26 04:14:44 2010 +0000 @@ -123,12 +123,8 @@ #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \ ((PidginBuddyListPrivate *)((list)->priv)) -#if GTK_CHECK_VERSION(2,4,0) static guint accounts_merge_id; static GtkActionGroup *accounts_action_group = NULL; -#else -static GtkWidget *accountmenu = NULL; -#endif static guint visibility_manager_count = 0; static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED; @@ -142,10 +138,8 @@ static void sort_method_alphabetical(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); static void sort_method_status(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); static void sort_method_log_activity(PurpleBlistNode *node, PurpleBuddyList *blist, GtkTreeIter groupiter, GtkTreeIter *cur, GtkTreeIter *iter); -#if GTK_CHECK_VERSION(2,4,0) static guint sort_merge_id; static GtkActionGroup *sort_action_group = NULL; -#endif static PidginBuddyList *gtkblist = NULL; @@ -157,9 +151,6 @@ static void pidgin_blist_update_group(PurpleBuddyList *list, PurpleBlistNode *node); static void pidgin_blist_update_contact(PurpleBuddyList *list, PurpleBlistNode *node); static char *pidgin_get_tooltip_text(PurpleBlistNode *node, gboolean full); -#if !GTK_CHECK_VERSION(2,4,0) -static const char *item_factory_translate_func (const char *path, gpointer func_data); -#endif static gboolean get_iter_from_node(PurpleBlistNode *node, GtkTreeIter *iter); static gboolean buddy_is_displayable(PurpleBuddy *buddy); static void redo_buddy_list(PurpleBuddyList *list, gboolean remove, gboolean rerender); @@ -2053,8 +2044,6 @@ return handled; } -#if GTK_CHECK_VERSION(2,4,0) - static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data) { pidgin_xfer_dialog_show(NULL); @@ -2112,74 +2101,13 @@ gtk_toggle_action_get_active(item)); } -#else /* GTK_CHECK_VERSION(2,4,0) */ - -static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_show_protocol_icons_cb(gpointer data, guint action, GtkWidget *item) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); -} - -static void pidgin_blist_show_empty_groups_cb(gpointer data, guint action, GtkWidget *item) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action, - GtkWidget *checkitem) -{ - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(checkitem))); - - pidgin_clear_cursor(gtkblist->window); -} - -static void pidgin_blist_mute_sounds_cb(gpointer data, guint action, GtkWidget *item) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(item))); -} - -#endif /* GTK_CHECK_VERSION(2,4,0) */ static void pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type, gconstpointer value, gpointer data) { -#if GTK_CHECK_VERSION(2,4,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds")), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(gtkblist->ift, - N_("/Tools/Mute Sounds"))), (gboolean)GPOINTER_TO_INT(value)); -#endif } static void @@ -2191,11 +2119,7 @@ if(!strcmp(value, "none")) sensitive = FALSE; -#if GTK_CHECK_VERSION(2,4,0) gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), sensitive); -#else - gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive); -#endif } static void @@ -3737,7 +3661,7 @@ /*************************************************** * Crap * ***************************************************/ -#if GTK_CHECK_VERSION(2,4,0) +#if 1 /* TODO: fill out tooltips... */ static const GtkActionEntry blist_menu_entries[] = { /* Buddies menu */ @@ -4738,7 +4662,7 @@ static const char *require_connection[] = { -#if GTK_CHECK_VERSION(2,4,0) +#if 1 "/BList/BuddiesMenu/NewInstantMessage", "/BList/BuddiesMenu/JoinAChat", "/BList/BuddiesMenu/GetUserInfo", @@ -4765,11 +4689,7 @@ static void update_menu_bar(PidginBuddyList *gtkblist) { -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; -#else - GtkWidget *widget; -#endif gboolean sensitive; int i; @@ -4779,7 +4699,6 @@ sensitive = (purple_connections_get_all() != NULL); -#if GTK_CHECK_VERSION(2,4,0) for (i = 0; i < require_connection_size; i++) { action = gtk_ui_manager_get_action(gtkblist->ui, require_connection[i]); @@ -4797,25 +4716,6 @@ action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/RoomList"); gtk_action_set_sensitive(action, pidgin_roomlist_is_showable()); -#else - for (i = 0; i < require_connection_size; i++) - { - widget = gtk_item_factory_get_widget(gtkblist->ift, require_connection[i]); - gtk_widget_set_sensitive(widget, sensitive); - } - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Join a Chat...")); - gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable()); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Add Chat...")); - gtk_widget_set_sensitive(widget, pidgin_blist_joinchat_is_showable()); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Privacy")); - gtk_widget_set_sensitive(widget, sensitive); - - widget = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Room List")); - gtk_widget_set_sensitive(widget, pidgin_roomlist_is_showable()); -#endif } static void @@ -5106,14 +5006,6 @@ NUM_TARGETS }; -#if !GTK_CHECK_VERSION(2,4,0) -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _((char *)path); -} -#endif - void pidgin_blist_setup_sort_methods() { const char *id; @@ -6061,10 +5953,8 @@ GtkWidget *close; char *pretty, *tmp; const char *theme_name; -#if GTK_CHECK_VERSION(2,4,0) GtkActionGroup *action_group; GError *error; -#endif GtkAccelGroup *accel_group; GtkTreeSelection *selection; GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW}, @@ -6114,7 +6004,6 @@ gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK); /******************************* Menu bar *************************************/ -#if GTK_CHECK_VERSION(2,4,0) action_group = gtk_action_group_new("BListActions"); gtk_action_group_add_actions(action_group, blist_menu_entries, @@ -6149,28 +6038,6 @@ gtk_widget_show(gtkblist->menutray); gtk_widget_show(menu); gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); -#else - accel_group = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW (gtkblist->window), accel_group); - g_object_unref(accel_group); - gtkblist->ift = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<PurpleMain>", accel_group); - gtk_item_factory_set_translate_func(gtkblist->ift, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - gtk_item_factory_create_items(gtkblist->ift, G_N_ENTRIES(blist_menu), - blist_menu, NULL); - pidgin_load_accels(); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL); - - menu = gtk_item_factory_get_widget(gtkblist->ift, "<PurpleMain>"); - gtkblist->menutray = pidgin_menu_tray_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray); - gtk_widget_show(gtkblist->menutray); - gtk_widget_show(menu); - gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0); - - accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts")); -#endif /****************************** Notebook *************************************/ gtkblist->notebook = gtk_notebook_new(); @@ -6362,7 +6229,6 @@ /* set the Show Offline Buddies option. must be done * after the treeview or faceprint gets mad. -Robot101 */ -#if GTK_CHECK_VERSION(2,4,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowOffline")), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); @@ -6384,30 +6250,6 @@ if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), FALSE); -#else - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Offline Buddies"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_offline_buddies")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Empty Groups"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_empty_groups")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Tools/Mute Sounds"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Buddy Details"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Idle Times"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Protocol Icons"))), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")); - - if(!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) - gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), FALSE); -#endif - /* Update some dynamic things */ update_menu_bar(gtkblist); pidgin_blist_update_plugin_actions(); @@ -7283,11 +7125,7 @@ gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; g_object_unref(G_OBJECT(gtkblist->treemodel)); gtkblist->treemodel = NULL; -#if GTK_CHECK_VERSION(2,4,0) g_object_unref(G_OBJECT(gtkblist->ui)); -#else - g_object_unref(G_OBJECT(gtkblist->ift)); -#endif g_object_unref(G_OBJECT(gtkblist->empty_avatar)); gdk_cursor_unref(gtkblist->hand_cursor); @@ -7301,9 +7139,6 @@ g_free(priv); g_free(gtkblist); -#if !GTK_CHECK_VERSION(2,4,0) - accountmenu = NULL; -#endif gtkblist = NULL; purple_prefs_disconnect_by_handle(pidgin_blist_get_handle()); } @@ -8313,7 +8148,6 @@ pam->callback(pam); } -#if GTK_CHECK_VERSION(2,4,0) static void build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent, PurplePlugin *plugin, gpointer context) @@ -8351,42 +8185,6 @@ g_list_free(actions); } -#else -static void -build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin, - gpointer context) -{ - GtkWidget *menuitem; - PurplePluginAction *action = NULL; - GList *actions, *l; - - actions = PURPLE_PLUGIN_ACTIONS(plugin, context); - - for (l = actions; l != NULL; l = l->next) - { - if (l->data) - { - action = (PurplePluginAction *) l->data; - action->plugin = plugin; - action->context = context; - - menuitem = gtk_menu_item_new_with_label(action->label); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); - - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(plugin_act), action); - g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", - action, - (GDestroyNotify)purple_plugin_action_free); - gtk_widget_show(menuitem); - } - else - pidgin_separator(menu); - } - - g_list_free(actions); -} -#endif static void modify_account_cb(GtkWidget *widget, gpointer data) @@ -8421,7 +8219,6 @@ { GList *accounts = NULL; -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; GString *accounts_ui; GString *enable_ui; @@ -8523,164 +8320,10 @@ g_string_free(enable_ui, TRUE); g_string_free(accounts_ui, TRUE); g_free(ui_string); -#else - GtkWidget *menuitem = NULL, *submenu = NULL; - GList *l = NULL; - GtkAccelGroup *accel_group = NULL; - gboolean disabled_accounts = FALSE; - gboolean enabled_accounts = FALSE; - - if (accountmenu == NULL) - return; - - /* Clear the old Accounts menu */ - for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) { - menuitem = l->data; - - if (menuitem != gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts/Manage Accounts"))) - gtk_widget_destroy(menuitem); - } - - for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { - char *buf = NULL; - GtkWidget *image = NULL; - PurpleAccount *account = NULL; - GdkPixbuf *pixbuf = NULL; - - account = accounts->data; - - if(!purple_account_get_enabled(account, PIDGIN_UI)) { - if (!disabled_accounts) { - menuitem = gtk_menu_item_new_with_label(_("Enable Account")); - gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); - - submenu = gtk_menu_new(); - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - gtk_menu_set_accel_path(GTK_MENU(submenu), N_("<PurpleMain>/Accounts/Enable Account")); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - disabled_accounts = TRUE; - } - - buf = g_strconcat(purple_account_get_username(account), " (", - purple_account_get_protocol_name(account), ")", NULL); - menuitem = gtk_image_menu_item_new_with_label(buf); - g_free(buf); - pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); - if (pixbuf != NULL) - { - if (!purple_account_is_connected(account)) - gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); - image = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); - } - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(enable_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } else { - enabled_accounts = TRUE; - } - } - - if (!enabled_accounts) { - gtk_widget_show_all(accountmenu); - return; - } - - pidgin_separator(accountmenu); - accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu)); - - for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) { - char *buf = NULL; - char *accel_path_buf = NULL; - GtkWidget *image = NULL; - PurpleConnection *gc = NULL; - PurpleAccount *account = NULL; - GdkPixbuf *pixbuf = NULL; - PurplePlugin *plugin = NULL; - PurplePluginProtocolInfo *prpl_info; - - account = accounts->data; - - if (!purple_account_get_enabled(account, PIDGIN_UI)) - continue; - - buf = g_strconcat(purple_account_get_username(account), " (", - purple_account_get_protocol_name(account), ")", NULL); - menuitem = gtk_image_menu_item_new_with_label(buf); - accel_path_buf = g_strconcat(N_("<PurpleMain>/Accounts/"), buf, NULL); - g_free(buf); - pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL); - if (pixbuf != NULL) { - if (!purple_account_is_connected(account)) - gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, - 0.0, FALSE); - image = gtk_image_new_from_pixbuf(pixbuf); - g_object_unref(G_OBJECT(pixbuf)); - gtk_widget_show(image); - gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); - } - gtk_menu_shell_append(GTK_MENU_SHELL(accountmenu), menuitem); - - submenu = gtk_menu_new(); - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - gtk_menu_set_accel_path(GTK_MENU(submenu), accel_path_buf); - g_free(accel_path_buf); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Edit Account")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(modify_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - - pidgin_separator(submenu); - - gc = purple_account_get_connection(account); - plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; - prpl_info = plugin ? PURPLE_PLUGIN_PROTOCOL_INFO(plugin) : NULL; - - if (prpl_info && - (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) || - PURPLE_PLUGIN_HAS_ACTIONS(plugin))) { - if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, get_moods) && - gc->flags & PURPLE_CONNECTION_SUPPORT_MOODS) { - - if (purple_account_get_status(account, "mood")) { - menuitem = gtk_menu_item_new_with_mnemonic(_("Set _Mood...")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(set_mood_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } - } - if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { - build_plugin_actions(submenu, plugin, gc); - } - } else { - menuitem = gtk_menu_item_new_with_label(_("No actions available")); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - gtk_widget_set_sensitive(menuitem, FALSE); - } - - pidgin_separator(submenu); - - menuitem = gtk_menu_item_new_with_mnemonic(_("_Disable")); - g_signal_connect(G_OBJECT(menuitem), "activate", - G_CALLBACK(disable_account_cb), account); - gtk_menu_shell_append(GTK_MENU_SHELL(submenu), menuitem); - } - gtk_widget_show_all(accountmenu); -#endif -} - -#if GTK_CHECK_VERSION(2,4,0) +} + static guint plugins_merge_id; static GtkActionGroup *plugins_action_group = NULL; -#else -static GList *plugin_submenus = NULL; -#endif void pidgin_blist_update_plugin_actions(void) @@ -8688,7 +8331,6 @@ PurplePlugin *plugin = NULL; GList *l; -#if GTK_CHECK_VERSION(2,4,0) GtkAction *action; GString *plugins_ui; gchar *ui_string; @@ -8745,53 +8387,8 @@ g_string_free(plugins_ui, TRUE); g_free(ui_string); -#else - GtkWidget *menuitem, *submenu; - GtkAccelGroup *accel_group; - GtkWidget *pluginmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools")); - - g_return_if_fail(pluginmenu != NULL); - - /* Remove old plugin action submenus from the Tools menu */ - for (l = plugin_submenus; l; l = l->next) - gtk_widget_destroy(GTK_WIDGET(l->data)); - g_list_free(plugin_submenus); - plugin_submenus = NULL; - - accel_group = gtk_menu_get_accel_group(GTK_MENU(pluginmenu)); - - /* Add a submenu for each plugin with custom actions */ - for (l = purple_plugins_get_loaded(); l; l = l->next) { - char *path; - - plugin = (PurplePlugin *) l->data; - - if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) - continue; - - if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) - continue; - - menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name)); - gtk_menu_shell_append(GTK_MENU_SHELL(pluginmenu), menuitem); - - plugin_submenus = g_list_append(plugin_submenus, menuitem); - - submenu = gtk_menu_new(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); - - gtk_menu_set_accel_group(GTK_MENU(submenu), accel_group); - path = g_strdup_printf("%s/Tools/%s", gtkblist->ift->path, plugin->info->name); - gtk_menu_set_accel_path(GTK_MENU(submenu), path); - g_free(path); - - build_plugin_actions(submenu, plugin, NULL); - } - gtk_widget_show_all(pluginmenu); -#endif -} - -#if GTK_CHECK_VERSION(2,4,0) +} + static void sortmethod_act(GtkRadioAction *action, GtkRadioAction *current, char *id) { @@ -8805,21 +8402,6 @@ pidgin_clear_cursor(gtkblist->window); } } -#else -static void -sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id) -{ - if (gtk_check_menu_item_get_active(checkmenuitem)) - { - pidgin_set_cursor(gtkblist->window, GDK_WATCH); - /* This is redundant. I think. */ - /* pidgin_blist_sort_method_set(id); */ - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/sort_type", id); - - pidgin_clear_cursor(gtkblist->window); - } -} -#endif void pidgin_blist_update_sort_methods(void) @@ -8829,7 +8411,6 @@ GSList *sl = NULL; const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type"); -#if GTK_CHECK_VERSION(2,4,0) GtkRadioAction *action; GString *ui_string; @@ -8878,38 +8459,4 @@ sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); g_string_free(ui_string, TRUE); -#else - GtkWidget *menuitem = NULL, *activeitem = NULL; - GtkWidget *sortmenu; - - if ((gtkblist == NULL) || (gtkblist->ift == NULL)) - return; - - g_return_if_fail(m != NULL); - - sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies")); - - if (sortmenu == NULL) - return; - - /* Clear the old menu */ - for (l = gtk_container_get_children(GTK_CONTAINER(sortmenu)); l; l = g_list_delete_link(l, l)) { - menuitem = l->data; - gtk_widget_destroy(GTK_WIDGET(menuitem)); - } - - for (l = pidgin_blist_sort_methods; l; l = l->next) { - method = (PidginBlistSortMethod *) l->data; - menuitem = gtk_radio_menu_item_new_with_label(sl, _(method->name)); - if (g_str_equal(m, method->id)) - activeitem = menuitem; - sl = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); - gtk_menu_shell_append(GTK_MENU_SHELL(sortmenu), menuitem); - g_signal_connect(G_OBJECT(menuitem), "toggled", - G_CALLBACK(sortmethod_act), method->id); - gtk_widget_show(menuitem); - } - if (activeitem) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE); -#endif -} +}
--- a/pidgin/gtkblist.h Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkblist.h Mon Jul 26 04:14:44 2010 +0000 @@ -82,11 +82,7 @@ GtkCellRenderer *text_rend; -#if GTK_CHECK_VERSION(2,4,0) GtkUIManager *ui; -#else - GtkItemFactory *ift; -#endif GtkWidget *menutray; /**< The menu tray widget. */ GtkWidget *menutrayicon; /**< The menu tray icon. */
--- a/pidgin/gtkconv.c Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkconv.c Mon Jul 26 04:14:44 2010 +0000 @@ -160,9 +160,6 @@ static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); static void update_typing_icon(PidginConversation *gtkconv); static void update_typing_message(PidginConversation *gtkconv, const char *message); -#if !GTK_CHECK_VERSION(2,6,0) -static const char *item_factory_translate_func (const char *path, gpointer func_data); -#endif gboolean pidgin_conv_has_focus(PurpleConversation *conv); static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); @@ -982,11 +979,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_new_conv_cb(GtkAction *action, gpointer data) -#else -menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget) -#endif { pidgin_dialogs_im(); } @@ -1033,11 +1026,7 @@ * plaintext v. HTML file. */ static void -#if GTK_CHECK_VERSION(2,6,0) menu_save_as_cb(GtkAction *action, gpointer data) -#else -menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1067,11 +1056,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_view_log_cb(GtkAction *action, gpointer data) -#else -menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1127,11 +1112,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_clear_cb(GtkAction *action, gpointer data) -#else -menu_clear_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1141,11 +1122,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_find_cb(GtkAction *action, gpointer data) -#else -menu_find_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *gtkwin = data; PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin); @@ -1155,7 +1132,6 @@ #ifdef USE_VV static void -#if GTK_CHECK_VERSION(2,6,0) menu_initiate_media_call_cb(GtkAction *action, gpointer data) { PidginWindow *win = (PidginWindow *)data; @@ -1169,29 +1145,10 @@ action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); } -#else -menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget) -{ - PidginWindow *win = (PidginWindow *)data; - PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); - PurpleAccount *account = purple_conversation_get_account(conv); - - purple_prpl_initiate_media(account, - purple_conversation_get_name(conv), - action == 0 ? PURPLE_MEDIA_AUDIO : - action == 1 ? PURPLE_MEDIA_VIDEO : - action == 2 ? PURPLE_MEDIA_AUDIO | - PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE); -} #endif -#endif - -static void -#if GTK_CHECK_VERSION(2,6,0) + +static void menu_send_file_cb(GtkAction *action, gpointer data) -#else -menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1203,11 +1160,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_get_attention_cb(GtkAction *ation, gpointer data) -#else -menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); @@ -1219,11 +1172,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_add_pounce_cb(GtkAction *action, gpointer data) -#else -menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1235,11 +1184,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_insert_link_cb(GtkAction *action, gpointer data) -#else -menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PidginConversation *gtkconv; @@ -1253,11 +1198,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_insert_image_cb(GtkAction *action, gpointer data) -#else -menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1274,11 +1215,7 @@ static void -#if GTK_CHECK_VERSION(2,6,0) menu_alias_cb(GtkAction *action, gpointer data) -#else -menu_alias_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1305,11 +1242,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_get_info_cb(GtkAction *action, gpointer data) -#else -menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1320,11 +1253,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_invite_cb(GtkAction *action, gpointer data) -#else -menu_invite_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1335,11 +1264,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_block_cb(GtkAction *action, gpointer data) -#else -menu_block_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1350,11 +1275,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_unblock_cb(GtkAction *action, gpointer data) -#else -menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1365,11 +1286,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_add_remove_cb(GtkAction *action, gpointer data) -#else -menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1414,11 +1331,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_close_conv_cb(GtkAction *action, gpointer data) -#else -menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; @@ -1426,11 +1339,7 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_logging_cb(GtkAction *action, gpointer data) -#else -menu_logging_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1442,11 +1351,7 @@ if (conv == NULL) return; -#if GTK_CHECK_VERSION(2,6,0) logging = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); -#else - logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); -#endif if (logging == purple_conversation_is_logging(conv)) return; @@ -1499,26 +1404,14 @@ } static void -#if GTK_CHECK_VERSION(2,6,0) menu_toolbar_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); } -#else -menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); -} -#endif - -static void -#if GTK_CHECK_VERSION(2,6,0) + +static void menu_sounds_cb(GtkAction *action, gpointer data) -#else -menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) -#endif { PidginWindow *win = data; PurpleConversation *conv; @@ -1533,30 +1426,18 @@ gtkconv = PIDGIN_CONVERSATION(conv); gtkconv->make_sound = -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); -#else - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); -#endif node = get_conversation_blist_node(conv); if (node) purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound); } static void -#if GTK_CHECK_VERSION(2,6,0) menu_timestamps_cb(GtkAction *action, gpointer data) { purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); } -#else -menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) -{ - purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps", - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); -} -#endif static void chat_do_im(PidginConversation *gtkconv, const char *who) @@ -2363,13 +2244,8 @@ purple_conversation_close_logs(old_conv); gtkconv->active_conv = conv; -#if GTK_CHECK_VERSION(2,6,0) purple_conversation_set_logging(conv, gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging))); -#else - purple_conversation_set_logging(conv, - gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); -#endif entry = GTK_IMHTML(gtkconv->entry); protocol_name = purple_account_get_protocol_name(conv->account); @@ -3192,7 +3068,7 @@ return gtkconv->win; } -#if GTK_CHECK_VERSION(2,6,0) +#if 1 static GtkActionEntry menu_entries[] = /* TODO: fill out tooltips... */ @@ -3363,16 +3239,6 @@ { N_("/Options/Show Formatting _Toolbars"), NULL, menu_toolbar_cb, 0, "<CheckItem>", NULL }, { N_("/Options/Show Ti_mestamps"), NULL, menu_timestamps_cb, 0, "<CheckItem>", NULL }, }; - -static const int menu_item_count = -sizeof(menu_items) / sizeof(*menu_items); - -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _(path); -} - #endif static void @@ -3384,31 +3250,18 @@ if (!strcmp(method, "none")) { -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), FALSE); gtk_action_set_sensitive(win->menu.sounds, FALSE); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - FALSE); - gtk_widget_set_sensitive(win->menu.sounds, FALSE); -#endif } else { PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win); -#if GTK_CHECK_VERSION(2,6,0) if (gtkconv != NULL) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), gtkconv->make_sound); gtk_action_set_sensitive(win->menu.sounds, TRUE); -#else - if (gtkconv != NULL) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - gtkconv->make_sound); - gtk_widget_set_sensitive(win->menu.sounds, TRUE); -#endif } } @@ -3536,7 +3389,6 @@ purple_prpl_get_media_caps(account, purple_conversation_get_name(conv)); -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, caps & PURPLE_MEDIA_CAPS_AUDIO ? TRUE : FALSE); @@ -3546,39 +3398,16 @@ gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO ? TRUE : FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, - caps & PURPLE_MEDIA_CAPS_AUDIO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->video_call, - caps & PURPLE_MEDIA_CAPS_VIDEO - ? TRUE : FALSE); - gtk_widget_set_sensitive(win->audio_video_call, - caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO - ? TRUE : FALSE); -#endif } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* for now, don't care about chats... */ -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, FALSE); gtk_action_set_sensitive(win->video_call, FALSE); gtk_action_set_sensitive(win->audio_video_call, FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); -#endif } else { -#if GTK_CHECK_VERSION(2,6,0) gtk_action_set_sensitive(win->audio_call, FALSE); gtk_action_set_sensitive(win->video_call, FALSE); gtk_action_set_sensitive(win->audio_video_call, FALSE); -#else - gtk_widget_set_sensitive(win->audio_call, FALSE); - gtk_widget_set_sensitive(win->video_call, FALSE); - gtk_widget_set_sensitive(win->audio_video_call, FALSE); -#endif } #endif } @@ -3671,7 +3500,7 @@ #endif } -#if !GTK_CHECK_VERSION(2,6,0) +#if 0 static void menubar_activated(GtkWidget *item, gpointer data) { PidginWindow *win = data; @@ -3702,8 +3531,6 @@ { GtkAccelGroup *accel_group; const char *method; - -#if GTK_CHECK_VERSION(2,6,0) GtkActionGroup *action_group; GError *error; @@ -3834,133 +3661,6 @@ "/Conversation/OptionsMenu/ShowTimestamps"); win->menu.show_icon = NULL; -#else - GtkWidget *menuitem; - - accel_group = gtk_accel_group_new (); - gtk_window_add_accel_group(GTK_WINDOW(win->window), accel_group); - g_object_unref(accel_group); - - win->menu.item_factory = - gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>", accel_group); - - gtk_item_factory_set_translate_func(win->menu.item_factory, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - - gtk_item_factory_create_items(win->menu.item_factory, menu_item_count, - menu_items, win); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", - G_CALLBACK(pidgin_save_accels_cb), NULL); - - /* Make sure the 'Conversation -> More' menuitems are regenerated whenever - * the 'Conversation' menu pops up because the entries can change after the - * conversation is created. */ - menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation")); - g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); - - win->menu.menubar = - gtk_item_factory_get_widget(win->menu.item_factory, "<main>"); - - win->menu.view_log = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/View Log")); - -#ifdef USE_VV - win->audio_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Audio Call")); - win->video_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Video Call")); - win->audio_video_call = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Media/Audio\\/Video Call")); -#endif - - /* --- */ - - win->menu.send_file = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Send File...")); - - g_object_set_data(G_OBJECT(win->window), "get_attention", - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Get Attention"))); - win->menu.add_pounce = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Add Buddy Pounce...")); - - /* --- */ - - win->menu.get_info = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Get Info")); - - win->menu.invite = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Invite...")); - - /* --- */ - - win->menu.alias = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Alias...")); - - win->menu.block = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Block...")); - - win->menu.unblock = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Unblock...")); - - win->menu.add = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Add...")); - - win->menu.remove = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Remove...")); - - /* --- */ - - win->menu.insert_link = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Insert Link...")); - - win->menu.insert_image = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Conversation/Insert Image...")); - - /* --- */ - - win->menu.logging = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Enable Logging")); - win->menu.sounds = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Enable Sounds")); - method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); - if (method != NULL && !strcmp(method, "none")) - { - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - FALSE); - gtk_widget_set_sensitive(win->menu.sounds, FALSE); - } - purple_prefs_connect_callback(win, PIDGIN_PREFS_ROOT "/sound/method", - sound_method_pref_changed_cb, win); - - win->menu.show_formatting_toolbar = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Show Formatting Toolbars")); - win->menu.show_timestamps = - gtk_item_factory_get_widget(win->menu.item_factory, - N_("/Options/Show Timestamps")); - win->menu.show_icon = NULL; - -#endif - win->menu.tray = pidgin_menu_tray_new(); gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), win->menu.tray); @@ -4142,8 +3842,7 @@ if (!(b = purple_find_buddy(account, conv->name))) return FALSE; -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ gtk_widget_show(win->menu.send_to); menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to)); @@ -4275,8 +3974,7 @@ static void generate_send_to_items(PidginWindow *win) { -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ GtkWidget *menu; GSList *group = NULL; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -6870,16 +6568,6 @@ gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); } -/* Mask functions with ones from newer GTK+ */ -#if GTK_CHECK_VERSION(2,6,0) -#define gtk_widget_set_sensitive_ gtk_widget_set_sensitive -#define gtk_widget_show_ gtk_widget_show -#define gtk_widget_hide_ gtk_widget_hide -#define gtk_widget_set_sensitive gtk_action_set_sensitive -#define gtk_widget_show(x) gtk_action_set_visible((x), TRUE) -#define gtk_widget_hide(x) gtk_action_set_visible((x), FALSE) -#endif - /* * Makes sure all the menu items and all the buttons are hidden/shown and * sensitive/insensitive. This is called after changing tabs and when an @@ -6918,57 +6606,57 @@ /* Show stuff that applies to IMs, hide stuff that applies to chats */ /* Deal with menu items */ - gtk_widget_show(win->menu.view_log); - gtk_widget_show(win->menu.send_file); - gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention")); - gtk_widget_show(win->menu.add_pounce); - gtk_widget_show(win->menu.get_info); - gtk_widget_hide(win->menu.invite); - gtk_widget_show(win->menu.alias); + gtk_action_set_visible(win->menu.view_log, TRUE); + gtk_action_set_visible(win->menu.send_file, TRUE); + gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), TRUE); + gtk_action_set_visible(win->menu.add_pounce, TRUE); + gtk_action_set_visible(win->menu.get_info, TRUE); + gtk_action_set_visible(win->menu.invite, FALSE); + gtk_action_set_visible(win->menu.alias, TRUE); if (purple_privacy_check(account, purple_conversation_get_name(conv))) { - gtk_widget_hide(win->menu.unblock); - gtk_widget_show(win->menu.block); + gtk_action_set_visible(win->menu.unblock, FALSE); + gtk_action_set_visible(win->menu.block, TRUE); } else { - gtk_widget_hide(win->menu.block); - gtk_widget_show(win->menu.unblock); + gtk_action_set_visible(win->menu.block, FALSE); + gtk_action_set_visible(win->menu.unblock, TRUE); } if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { - gtk_widget_show(win->menu.add); - gtk_widget_hide(win->menu.remove); + gtk_action_set_visible(win->menu.add, TRUE); + gtk_action_set_visible(win->menu.remove, FALSE); } else { - gtk_widget_show(win->menu.remove); - gtk_widget_hide(win->menu.add); - } - - gtk_widget_show(win->menu.insert_link); - gtk_widget_show(win->menu.insert_image); + gtk_action_set_visible(win->menu.remove, TRUE); + gtk_action_set_visible(win->menu.add, FALSE); + } + + gtk_action_set_visible(win->menu.insert_link, TRUE); + gtk_action_set_visible(win->menu.insert_image, TRUE); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { /* Show stuff that applies to Chats, hide stuff that applies to IMs */ /* Deal with menu items */ - gtk_widget_show(win->menu.view_log); - gtk_widget_hide(win->menu.send_file); - gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention")); - gtk_widget_hide(win->menu.add_pounce); - gtk_widget_hide(win->menu.get_info); - gtk_widget_show(win->menu.invite); - gtk_widget_show(win->menu.alias); - gtk_widget_hide(win->menu.block); - gtk_widget_hide(win->menu.unblock); + gtk_action_set_visible(win->menu.view_log, TRUE); + gtk_action_set_visible(win->menu.send_file, FALSE); + gtk_action_set_visible(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); + gtk_action_set_visible(win->menu.add_pounce, FALSE); + gtk_action_set_visible(win->menu.get_info, FALSE); + gtk_action_set_visible(win->menu.invite, TRUE); + gtk_action_set_visible(win->menu.alias, TRUE); + gtk_action_set_visible(win->menu.block, FALSE); + gtk_action_set_visible(win->menu.unblock, FALSE); if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) { /* If the chat is NOT in the buddy list */ - gtk_widget_show(win->menu.add); - gtk_widget_hide(win->menu.remove); + gtk_action_set_visible(win->menu.add, TRUE); + gtk_action_set_visible(win->menu.remove, FALSE); } else { /* If the chat IS in the buddy list */ - gtk_widget_hide(win->menu.add); - gtk_widget_show(win->menu.remove); - } - - gtk_widget_show(win->menu.insert_link); - gtk_widget_show(win->menu.insert_image); + gtk_action_set_visible(win->menu.add, FALSE); + gtk_action_set_visible(win->menu.remove, TRUE); + } + + gtk_action_set_visible(win->menu.insert_link, TRUE); + gtk_action_set_visible(win->menu.insert_image, TRUE); } /* @@ -7013,30 +6701,30 @@ gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); /* Deal with menu items */ - gtk_widget_set_sensitive(win->menu.view_log, TRUE); - gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); - gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); - gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); - gtk_widget_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); - gtk_widget_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); + gtk_action_set_sensitive(win->menu.view_log, TRUE); + gtk_action_set_sensitive(win->menu.add_pounce, TRUE); + gtk_action_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); + gtk_action_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); + gtk_action_set_sensitive(win->menu.insert_link, (conv->features & PURPLE_CONNECTION_HTML)); + gtk_action_set_sensitive(win->menu.insert_image, !(conv->features & PURPLE_CONNECTION_NO_IMAGES)); if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { - gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); - gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); - gtk_widget_set_sensitive(win->menu.send_file, + gtk_action_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); + gtk_action_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); + gtk_action_set_sensitive(win->menu.send_file, (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); - gtk_widget_set_sensitive(win->menu.alias, + gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL)); + gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { - gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); - gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); - gtk_widget_set_sensitive(win->menu.alias, + gtk_action_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); + gtk_action_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); + gtk_action_set_sensitive(win->menu.alias, (account != NULL) && (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); } @@ -7046,18 +6734,18 @@ /* Or it's a chat that we've left. */ /* Then deal with menu items */ - gtk_widget_set_sensitive(win->menu.view_log, TRUE); - gtk_widget_set_sensitive(win->menu.send_file, FALSE); - gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), + gtk_action_set_sensitive(win->menu.view_log, TRUE); + gtk_action_set_sensitive(win->menu.send_file, FALSE); + gtk_action_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), FALSE); - gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); - gtk_widget_set_sensitive(win->menu.get_info, FALSE); - gtk_widget_set_sensitive(win->menu.invite, FALSE); - gtk_widget_set_sensitive(win->menu.alias, FALSE); - gtk_widget_set_sensitive(win->menu.add, FALSE); - gtk_widget_set_sensitive(win->menu.remove, FALSE); - gtk_widget_set_sensitive(win->menu.insert_link, TRUE); - gtk_widget_set_sensitive(win->menu.insert_image, FALSE); + gtk_action_set_sensitive(win->menu.add_pounce, TRUE); + gtk_action_set_sensitive(win->menu.get_info, FALSE); + gtk_action_set_sensitive(win->menu.invite, FALSE); + gtk_action_set_sensitive(win->menu.alias, FALSE); + gtk_action_set_sensitive(win->menu.add, FALSE); + gtk_action_set_sensitive(win->menu.remove, FALSE); + gtk_action_set_sensitive(win->menu.insert_link, TRUE); + gtk_action_set_sensitive(win->menu.insert_image, FALSE); } /* @@ -7089,17 +6777,6 @@ } } -/* Restore the functions */ -#if GTK_CHECK_VERSION(2,6,0) -#undef gtk_widget_set_sensitive -#undef gtk_widget_show -#undef gtk_widget_hide - -#define gtk_widget_set_sensitive gtk_widget_set_sensitive_ -#define gtk_widget_show gtk_widget_show_ -#define gtk_widget_hide gtk_widget_hide_ -#endif - static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) { @@ -7756,15 +7433,9 @@ gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active( - GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), - (gboolean)GPOINTER_TO_INT(value)); -#endif gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), (gboolean)GPOINTER_TO_INT(value)); @@ -7790,15 +7461,9 @@ gtkconv = PIDGIN_CONVERSATION(conv); win = gtkconv->win; -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), (gboolean)GPOINTER_TO_INT(value)); -#else - gtk_check_menu_item_set_active( - GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), - (gboolean)GPOINTER_TO_INT(value)); -#endif if ((gboolean)GPOINTER_TO_INT(value)) gtk_widget_show(gtkconv->toolbar); @@ -9054,8 +8719,7 @@ /* Right click was pressed. Popup the context menu. */ GtkWidget *menu = gtk_menu_new(), *sub; gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE); -#if GTK_CHECK_VERSION(2,6,0) -#else +#if 0 /* TODO */ sub = gtk_menu_item_get_submenu(GTK_MENU_ITEM(gtkconv->win->menu.send_to)); if (sub && GTK_WIDGET_IS_SENSITIVE(gtkconv->win->menu.send_to)) { @@ -9578,13 +9242,8 @@ /* Update the menubar */ -#if GTK_CHECK_VERSION(2,6,0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging), purple_conversation_is_logging(conv)); -#else - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), - purple_conversation_is_logging(conv)); -#endif generate_send_to_items(win); regenerate_options_items(win); @@ -9593,7 +9252,6 @@ pidgin_conv_switch_active_conversation(conv); sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"); -#if GTK_CHECK_VERSION(2,6,0) if (strcmp(sound_method, "none") != 0) gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), gtkconv->make_sound); @@ -9603,17 +9261,6 @@ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); -#else - if (strcmp(sound_method, "none") != 0) - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), - gtkconv->make_sound); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); - - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), - purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); -#endif /* * We pause icons when they are not visible. If this icon should @@ -9863,11 +9510,7 @@ } gtk_widget_destroy(win->window); -#if GTK_CHECK_VERSION(2,6,0) g_object_unref(G_OBJECT(win->menu.ui)); -#else - g_object_unref(G_OBJECT(win->menu.item_factory)); -#endif purple_notify_close_with_handle(win); purple_signals_disconnect_by_handle(win);
--- a/pidgin/gtkconvwin.h Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkconvwin.h Mon Jul 26 04:14:44 2010 +0000 @@ -46,10 +46,8 @@ struct { -/* Some necessary functions were only added in 2.6.0 */ GtkWidget *menubar; -#if GTK_CHECK_VERSION(2,6,0) GtkAction *view_log; GtkAction *send_file; @@ -70,28 +68,7 @@ GtkAction *sounds; GtkAction *show_formatting_toolbar; GtkAction *show_timestamps; -#else - GtkWidget *view_log; - GtkWidget *send_file; - GtkWidget *add_pounce; - GtkWidget *get_info; - GtkWidget *invite; - - GtkWidget *alias; - GtkWidget *block; - GtkWidget *unblock; - GtkWidget *add; - GtkWidget *remove; - - GtkWidget *insert_link; - GtkWidget *insert_image; - - GtkWidget *logging; - GtkWidget *sounds; - GtkWidget *show_formatting_toolbar; - GtkWidget *show_timestamps; -#endif GtkWidget *show_icon; GtkWidget *send_to; @@ -100,11 +77,7 @@ GtkWidget *typing_icon; -#if GTK_CHECK_VERSION(2,6,0) GtkUIManager *ui; -#else - GtkItemFactory *item_factory; -#endif } menu; @@ -126,15 +99,9 @@ gint drag_leave_signal; /* Media menu options. */ -#if GTK_CHECK_VERSION(2,6,0) GtkAction *audio_call; GtkAction *video_call; GtkAction *audio_video_call; -#else - GtkWidget *audio_call; - GtkWidget *video_call; - GtkWidget *audio_video_call; -#endif }; /*@}*/
--- a/pidgin/gtkdocklet.c Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkdocklet.c Mon Jul 26 04:14:44 2010 +0000 @@ -523,7 +523,7 @@ new_menu_item_with_status_icon(menu, purple_status_type_get_name(status_type), prim, G_CALLBACK(activate_status_account_cb), - status_type, 0, 0, NULL); + GINT_TO_POINTER(status_type), 0, 0, NULL); } }
--- a/pidgin/gtkmedia.c Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkmedia.c Mon Jul 26 04:14:44 2010 +0000 @@ -84,11 +84,7 @@ gchar *screenname; gulong level_handler_id; -#if GTK_CHECK_VERSION(2,4,0) GtkUIManager *ui; -#else - GtkItemFactory *item_factory; -#endif GtkWidget *menubar; GtkWidget *statusbar; @@ -264,18 +260,13 @@ #endif static void -#if GTK_CHECK_VERSION(2,4,0) menu_hangup(GtkAction *action, gpointer data) -#else -menu_hangup(gpointer data, guint action, GtkWidget *item) -#endif { PidginMedia *gtkmedia = PIDGIN_MEDIA(data); purple_media_stream_info(gtkmedia->priv->media, PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); } -#if GTK_CHECK_VERSION(2,4,0) static const GtkActionEntry menu_entries[] = { { "MediaMenu", NULL, N_("_Media"), NULL, NULL, NULL }, { "Hangup", NULL, N_("_Hangup"), NULL, NULL, G_CALLBACK(menu_hangup) }, @@ -290,32 +281,14 @@ "</menubar>" "</ui>"; -#else -static GtkItemFactoryEntry menu_items[] = { - { N_("/_Media"), NULL, NULL, 0, "<Branch>", NULL }, - { N_("/Media/_Hangup"), NULL, menu_hangup, 0, "<Item>", NULL }, -}; - -static gint menu_item_count = sizeof(menu_items) / sizeof(menu_items[0]); - -static const char * -item_factory_translate_func (const char *path, gpointer func_data) -{ - return _(path); -} -#endif - static GtkWidget * setup_menubar(PidginMedia *window) { -#if GTK_CHECK_VERSION(2,4,0) GtkActionGroup *action_group; GError *error; -#endif GtkAccelGroup *accel_group; GtkWidget *menu; -#if GTK_CHECK_VERSION(2,4,0) action_group = gtk_action_group_new("MediaActions"); gtk_action_group_add_actions(action_group, menu_entries, @@ -341,26 +314,6 @@ } menu = gtk_ui_manager_get_widget(window->priv->ui, "/Media"); -#else - accel_group = gtk_accel_group_new (); - gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); - g_object_unref(accel_group); - - window->priv->item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, - "<main>", accel_group); - - gtk_item_factory_set_translate_func(window->priv->item_factory, - (GtkTranslateFunc)item_factory_translate_func, - NULL, NULL); - - gtk_item_factory_create_items(window->priv->item_factory, - menu_item_count, menu_items, window); - g_signal_connect(G_OBJECT(accel_group), "accel-changed", - G_CALLBACK(pidgin_save_accels_cb), NULL); - - menu = gtk_item_factory_get_widget( - window->priv->item_factory, "<main>"); -#endif gtk_widget_show(menu); return menu; @@ -441,17 +394,10 @@ gtkmedia->priv->media = NULL; } -#if GTK_CHECK_VERSION(2,4,0) if (gtkmedia->priv->ui) { g_object_unref(gtkmedia->priv->ui); gtkmedia->priv->ui = NULL; } -#else - if (gtkmedia->priv->item_factory) { - g_object_unref(gtkmedia->priv->item_factory); - gtkmedia->priv->item_factory = NULL; - } -#endif G_OBJECT_CLASS(parent_class)->dispose(media); }
--- a/pidgin/gtkutils.c Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkutils.c Mon Jul 26 04:14:44 2010 +0000 @@ -912,31 +912,6 @@ return optmenu; } -gboolean -#if GTK_CHECK_VERSION(2,4,0) -pidgin_check_if_dir(const char *path, gpointer filesel) -{ - return FALSE; -} -#else -pidgin_check_if_dir(const char *path, GtkFileSelection *filesel) -{ - char *dirname = NULL; - - if (g_file_test(path, G_FILE_TEST_IS_DIR)) { - /* append a / if needed */ - if (path[strlen(path) - 1] != G_DIR_SEPARATOR) { - dirname = g_strconcat(path, G_DIR_SEPARATOR_S, NULL); - } - gtk_file_selection_set_filename(filesel, (dirname != NULL) ? dirname : path); - g_free(dirname); - return TRUE; - } - - return FALSE; -} -#endif - void pidgin_setup_gtkspell(GtkTextView *textview) {
--- a/pidgin/gtkutils.h Sun Jul 25 23:40:05 2010 +0000 +++ b/pidgin/gtkutils.h Mon Jul 26 04:14:44 2010 +0000 @@ -402,22 +402,6 @@ void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all); /** - * Check if the given path is a directory or not. If it is, then modify - * the given GtkFileSelection dialog so that it displays the given path. - * If the given path is not a directory, then do nothing. - * - * @param path The path entered in the file selection window by the user. - * @param filesel The file selection window. - * - * @return TRUE if given path is a directory, FALSE otherwise. - */ -#if GTK_CHECK_VERSION(2,4,0) -gboolean pidgin_check_if_dir(const char *path, gpointer filesel); -#else -gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel); -#endif - -/** * Sets up GtkSpell for the given GtkTextView, reporting errors * if encountered. *