Mercurial > pidgin
changeset 11888:7d2d926704aa
[gaim-migrate @ 14179]
Gtk 2.0 support. Deja Vu.
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 29 Oct 2005 14:45:15 +0000 |
parents | 6f514bb8f0a9 |
children | 04c2c3d84849 |
files | src/gtkmenutray.c src/gtkplugin.c src/gtkprefs.c src/gtksavedstatuses.c |
diffstat | 4 files changed, 40 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkmenutray.c Sat Oct 29 13:23:19 2005 +0000 +++ b/src/gtkmenutray.c Sat Oct 29 14:45:15 2005 +0000 @@ -121,7 +121,9 @@ static void gaim_gtk_menu_tray_init(GaimGtkMenuTray *menu_tray) { GtkWidget *widget = GTK_WIDGET(menu_tray); +#if GTK_CHECK_VERSION(2,2,0) GtkSettings *settings; +#endif gint height = -1; gtk_menu_item_set_right_justified(GTK_MENU_ITEM(menu_tray), TRUE); @@ -132,12 +134,12 @@ #if GTK_CHECK_VERSION(2,2,0) settings = gtk_settings_get_for_screen(gtk_widget_get_screen(widget)); -#else - settings = gtk_settings_get_default(); -#endif if(gtk_icon_size_lookup_for_settings(settings, GTK_ICON_SIZE_MENU, NULL, &height)) +#else + if(gtk_icon_size_lookup(GTK_ICON_SIZE_MENU, NULL, &height)) +#endif { gtk_widget_set_size_request(widget, -1, height); }
--- a/src/gtkplugin.c Sat Oct 29 13:23:19 2005 +0000 +++ b/src/gtkplugin.c Sat Oct 29 14:45:15 2005 +0000 @@ -295,8 +295,10 @@ case GTK_RESPONSE_CLOSE: case GTK_RESPONSE_DELETE_EVENT: gtk_widget_destroy(d); - g_hash_table_destroy(plugin_pref_dialogs); - plugin_pref_dialogs = NULL; + if (plugin_pref_dialogs != NULL) { + g_hash_table_destroy(plugin_pref_dialogs); + plugin_pref_dialogs = NULL; + } plugin_dialog = NULL; break; case 98121:
--- a/src/gtkprefs.c Sat Oct 29 13:23:19 2005 +0000 +++ b/src/gtkprefs.c Sat Oct 29 14:45:15 2005 +0000 @@ -934,7 +934,7 @@ GtkWidget *vbox, *hbox, *entry; GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button, *stun_server_entry; GtkSizeGroup *sg; - GaimProxyInfo *proxy_info; + GaimProxyInfo *proxy_info = NULL; ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER);
--- a/src/gtksavedstatuses.c Sat Oct 29 13:23:19 2005 +0000 +++ b/src/gtksavedstatuses.c Sat Oct 29 14:45:15 2005 +0000 @@ -131,6 +131,23 @@ return FALSE; } +#if !GTK_CHECK_VERSION(2,2,0) +static void +count_selected_helper(GtkTreeModel *model, GtkTreePath *path, + GtkTreeIter *iter, gpointer user_data) +{ + (*(gint *)user_data)++; +} + +static void +list_selected_helper(GtkTreeModel *model, GtkTreePath *path, + GtkTreeIter *iter, gpointer user_data) +{ + GList *list = (GList *)user_data; + list = g_list_append(list, path); +} +#endif + static void status_window_use_cb(GtkButton *button, StatusWindow *dialog) { @@ -138,17 +155,27 @@ GtkTreeIter iter; GaimSavedStatus *saved_status; GList *list; + int num_selected = 0; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); - if (gtk_tree_selection_count_selected_rows(selection) != 1) +#if GTK_CHECK_VERSION(2,2,0) + num_selected = gtk_tree_selection_count_selected_rows(selection); +#else + gtk_tree_selection_selected_foreach(selection, count_selected_helper, &num_selected); +#endif + if (num_selected != 1) /* * This shouldn't happen because the "Use" button should have * been grayed out. Oh well. */ return; +#if GTK_CHECK_VERSION(2,2,0) list = gtk_tree_selection_get_selected_rows(selection, NULL); +#else + gtk_tree_selection_selected_foreach(selection, list_selected_helper, &list); +#endif if (gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, list->data)) @@ -239,25 +266,16 @@ gaim_gtk_status_window_hide(); } -#if !GTK_CHECK_VERSION(2,2,0) -static void -get_selected_helper(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, gpointer user_data) -{ - *((gboolean *)user_data)++; -} -#endif - static void status_selected_cb(GtkTreeSelection *sel, gpointer user_data) { StatusWindow *dialog = user_data; - int num_selected; + int num_selected = 0; #if GTK_CHECK_VERSION(2,2,0) num_selected = gtk_tree_selection_count_selected_rows(sel); #else - gtk_tree_selection_selected_foreach(sel, get_selected_helper, &num_selected); + gtk_tree_selection_selected_foreach(sel, count_selected_helper, &num_selected); #endif gtk_widget_set_sensitive(dialog->use_button, (num_selected == 1));