Mercurial > pidgin.yaz
changeset 29484:21277e69e06c
Kill off more GTK_CHECK_VERSION uses that we don't need anymore. Refs #10024.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 23 Aug 2009 15:33:52 +0000 |
parents | 4e968ede8838 |
children | 48ea900ee72a |
files | pidgin/gtkrequest.c pidgin/gtksavedstatuses.c pidgin/gtkscrollbook.c pidgin/gtksession.c pidgin/pidginstock.c pidgin/pidgintooltip.c pidgin/plugins/gestures/gestures.c pidgin/plugins/pidginrc.c pidgin/plugins/spellchk.c pidgin/plugins/xmppconsole.c |
diffstat | 10 files changed, 1 insertions(+), 234 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkrequest.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/gtkrequest.c Sun Aug 23 15:33:52 2009 +0000 @@ -595,9 +595,7 @@ /* Create the dialog. */ data->dialog = dialog = gtk_dialog_new(); -#if GTK_CHECK_VERSION(2,10,0) gtk_window_set_deletable(GTK_WINDOW(data->dialog), FALSE); -#endif if (title != NULL) gtk_window_set_title(GTK_WINDOW(dialog), title); @@ -1445,7 +1443,6 @@ } } -#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ static void file_ok_check_if_exists_cb(GtkWidget *widget, gint response, PidginRequestData *data) { @@ -1470,51 +1467,6 @@ } g_free(current_folder); } - -#else /* FILECHOOSER */ - -static void -file_ok_check_if_exists_cb(GtkWidget *button, PidginRequestData *data) -{ - const gchar *name; - gchar *current_folder; - - generic_response_start(data); - - name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->dialog)); - - /* If name is a directory then change directories */ - if (data->type == PURPLE_REQUEST_FILE) { - if (pidgin_check_if_dir(name, GTK_FILE_SELECTION(data->dialog))) - return; - } - - current_folder = g_path_get_dirname(name); - - g_free(data->u.file.name); - if (data->type == PURPLE_REQUEST_FILE) - data->u.file.name = g_strdup(name); - else - { - if (g_file_test(name, G_FILE_TEST_IS_DIR)) - data->u.file.name = g_strdup(name); - else - data->u.file.name = g_strdup(current_folder); - } - - if (current_folder != NULL) { - if (data->u.file.savedialog) { - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder", current_folder); - } else { - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder", current_folder); - } - g_free(current_folder); - } - -#endif /* FILECHOOSER */ -#if 0 /* mismatched curly braces */ - } -#endif if ((data->u.file.savedialog == TRUE) && (g_file_test(data->u.file.name, G_FILE_TEST_EXISTS))) { purple_request_action(data, NULL, _("That file already exists"), @@ -1527,20 +1479,6 @@ file_yes_no_cb(data, 1); } -#if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ -static gboolean -file_cancel_cb(PidginRequestData *data) -{ - generic_response_start(data); - - if (data->cbs[0] != NULL) - ((PurpleRequestFileCb)data->cbs[0])(data->user_data, NULL); - - purple_request_close(data->type, data); - return FALSE; -} -#endif /* FILECHOOSER */ - static void * pidgin_request_file(const char *title, const char *filename, gboolean savedialog, @@ -1551,9 +1489,7 @@ PidginRequestData *data; GtkWidget *filesel; const gchar *current_folder; -#if GTK_CHECK_VERSION(2,4,0) gboolean folder_set = FALSE; -#endif data = g_new0(PidginRequestData, 1); data->type = PURPLE_REQUEST_FILE; @@ -1564,7 +1500,6 @@ data->cbs[1] = ok_cb; data->u.file.savedialog = savedialog; -#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ filesel = gtk_file_chooser_dialog_new( title ? title : (savedialog ? _("Save File...") : _("Open File...")), @@ -1610,30 +1545,6 @@ #endif g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(filesel)), "response", G_CALLBACK(file_ok_check_if_exists_cb), data); -#else /* FILECHOOSER */ - filesel = gtk_file_selection_new( - title ? title : (savedialog ? _("Save File...") - : _("Open File..."))); - if (savedialog) { - current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_save_folder"); - } else { - current_folder = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder"); - } - if (current_folder != NULL) { - gchar *path = g_strdup_printf("%s%s", current_folder, G_DIR_SEPARATOR_S); - gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), path); - g_free(path); - } - if (filename != NULL) - gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), filename); - - g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)), "delete_event", - G_CALLBACK(file_cancel_cb), data); - g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), - "clicked", G_CALLBACK(file_cancel_cb), data); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked", - G_CALLBACK(file_ok_check_if_exists_cb), data); -#endif /* FILECHOOSER */ pidgin_auto_parent_window(filesel); @@ -1661,7 +1572,6 @@ data->cbs[1] = ok_cb; data->u.file.savedialog = FALSE; -#if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ dirsel = gtk_file_chooser_dialog_new( title ? title : _("Select Folder..."), NULL, @@ -1676,16 +1586,6 @@ g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(dirsel)), "response", G_CALLBACK(file_ok_check_if_exists_cb), data); -#else - dirsel = gtk_file_selection_new(title ? title : _("Select Folder...")); - - g_signal_connect_swapped(G_OBJECT(dirsel), "delete_event", - G_CALLBACK(file_cancel_cb), data); - g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(dirsel)->cancel_button), - "clicked", G_CALLBACK(file_cancel_cb), data); - g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dirsel)->ok_button), "clicked", - G_CALLBACK(file_ok_check_if_exists_cb), data); -#endif data->dialog = dirsel; pidgin_auto_parent_window(dirsel);
--- a/pidgin/gtksavedstatuses.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/gtksavedstatuses.c Sun Aug 23 15:33:52 2009 +0000 @@ -179,23 +179,6 @@ 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, gtk_tree_path_copy(path)); -} -#endif - static void status_window_use_cb(GtkButton *button, StatusWindow *dialog) { @@ -206,11 +189,7 @@ selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); -#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 @@ -218,11 +197,7 @@ */ 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)) @@ -310,11 +285,7 @@ gpointer handle; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->treeview)); -#if GTK_CHECK_VERSION(2,2,0) sel_paths = gtk_tree_selection_get_selected_rows(selection, NULL); -#else - gtk_tree_selection_selected_foreach(selection, list_selected_helper, &sel_paths); -#endif /* This is ugly because we're not allowed to modify the model from within * gtk_tree_selection_selected_foreach() and the GtkTreePaths can become invalid @@ -364,11 +335,7 @@ int num_selected; GtkTreeModel *model = GTK_TREE_MODEL(dialog->model); -#if GTK_CHECK_VERSION(2,2,0) sel_paths = gtk_tree_selection_get_selected_rows(sel, NULL); -#else - gtk_tree_selection_selected_foreach(sel, list_selected_helper, &sel_paths); -#endif for (tmp = sel_paths, num_selected = 0; tmp; tmp = tmp->next, num_selected++) { GtkTreeIter iter; @@ -520,9 +487,7 @@ gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", STATUS_WINDOW_COLUMN_TITLE); -#if GTK_CHECK_VERSION(2,6,0) g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); -#endif column = gtk_tree_view_column_new(); gtk_tree_view_column_set_title(column, _("Type")); @@ -549,9 +514,7 @@ gtk_tree_view_column_pack_start(column, renderer, TRUE); gtk_tree_view_column_add_attribute(column, renderer, "text", STATUS_WINDOW_COLUMN_MESSAGE); -#if GTK_CHECK_VERSION(2,6,0) g_object_set(renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL); -#endif /* Enable CTRL+F searching */ gtk_tree_view_set_search_column(GTK_TREE_VIEW(treeview), STATUS_WINDOW_COLUMN_TITLE);
--- a/pidgin/gtkscrollbook.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/gtkscrollbook.c Sun Aug 23 15:33:52 2009 +0000 @@ -80,11 +80,7 @@ { int index, count; index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); -#if GTK_CHECK_VERSION(2,2,0) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); -#else - count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children); -#endif if (index + 1 < count) gtk_notebook_set_current_page(GTK_NOTEBOOK(scroll_book->notebook), index + 1); @@ -130,11 +126,7 @@ { int count; int index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook)); -#if GTK_CHECK_VERSION(2,2,0) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); -#else - count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children); -#endif refresh_scroll_box(scroll_book, index, count); } @@ -149,11 +141,7 @@ switch_page_cb(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, PidginScrollBook *scroll_book) { int count; -#if GTK_CHECK_VERSION(2,2,0) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook)); -#else - count = g_list_length(GTK_NOTEBOOK(scroll_book->notebook)->children); -#endif refresh_scroll_box(scroll_book, page_num, count); } @@ -268,9 +256,7 @@ /* Close */ eb = gtk_event_box_new(); gtk_box_pack_end(GTK_BOX(scroll_book->hbox), eb, FALSE, FALSE, 0); -#if GTK_CHECK_VERSION(2,4,0) gtk_event_box_set_visible_window(GTK_EVENT_BOX(eb), FALSE); -#endif gtk_widget_set_events(eb, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); close_button = gtk_label_new("×"); g_signal_connect(G_OBJECT(eb), "enter-notify-event", G_CALLBACK(close_button_entered_cb), close_button);
--- a/pidgin/gtksession.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/gtksession.c Sun Aug 23 15:33:52 2009 +0000 @@ -163,10 +163,8 @@ ret[j++] = g_strdup(config_dir); } -#if GTK_CHECK_VERSION(2,2,0) ret[j++] = g_strdup("--display"); ret[j++] = g_strdup((gchar *)gdk_display_get_name(gdk_display_get_default())); -#endif ret[j++] = NULL;
--- a/pidgin/pidginstock.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/pidginstock.c Sun Aug 23 15:33:52 2009 +0000 @@ -53,49 +53,29 @@ } const stock_icons[] = { { PIDGIN_STOCK_ACTION, NULL, GTK_STOCK_EXECUTE }, -#if GTK_CHECK_VERSION(2,6,0) { PIDGIN_STOCK_ALIAS, NULL, GTK_STOCK_EDIT }, -#else - { PIDGIN_STOCK_ALIAS, "buttons", "edit.png" }, -#endif { PIDGIN_STOCK_CHAT, NULL, GTK_STOCK_JUMP_TO }, { PIDGIN_STOCK_CLEAR, NULL, GTK_STOCK_CLEAR }, { PIDGIN_STOCK_CLOSE_TABS, NULL, GTK_STOCK_CLOSE }, { PIDGIN_STOCK_DEBUG, NULL, GTK_STOCK_PROPERTIES }, { PIDGIN_STOCK_DOWNLOAD, NULL, GTK_STOCK_GO_DOWN }, -#if GTK_CHECK_VERSION(2,6,0) { PIDGIN_STOCK_DISCONNECT, NULL, GTK_STOCK_DISCONNECT }, -#else - { PIDGIN_STOCK_DISCONNECT, "icons", "stock_disconnect_16.png" }, -#endif { PIDGIN_STOCK_FGCOLOR, "buttons", "change-fgcolor-small.png" }, -#if GTK_CHECK_VERSION(2,6,0) { PIDGIN_STOCK_EDIT, NULL, GTK_STOCK_EDIT }, -#else - { PIDGIN_STOCK_EDIT, "buttons", "edit.png" }, -#endif { PIDGIN_STOCK_FILE_CANCELED, NULL, GTK_STOCK_CANCEL }, { PIDGIN_STOCK_FILE_DONE, NULL, GTK_STOCK_APPLY }, { PIDGIN_STOCK_IGNORE, NULL, GTK_STOCK_DIALOG_ERROR }, { PIDGIN_STOCK_INVITE, NULL, GTK_STOCK_JUMP_TO }, { PIDGIN_STOCK_MODIFY, NULL, GTK_STOCK_PREFERENCES }, { PIDGIN_STOCK_ADD, NULL, GTK_STOCK_ADD }, -#if GTK_CHECK_VERSION(2,6,0) { PIDGIN_STOCK_PAUSE, NULL, GTK_STOCK_MEDIA_PAUSE }, -#else - { PIDGIN_STOCK_PAUSE, "buttons", "pause.png" }, -#endif { PIDGIN_STOCK_POUNCE, NULL, GTK_STOCK_REDO }, { PIDGIN_STOCK_OPEN_MAIL, NULL, GTK_STOCK_JUMP_TO }, { PIDGIN_STOCK_SIGN_ON, NULL, GTK_STOCK_EXECUTE }, { PIDGIN_STOCK_SIGN_OFF, NULL, GTK_STOCK_CLOSE }, { PIDGIN_STOCK_TYPED, "pidgin", "typed.png" }, { PIDGIN_STOCK_UPLOAD, NULL, GTK_STOCK_GO_UP }, -#if GTK_CHECK_VERSION(2,8,0) { PIDGIN_STOCK_INFO, NULL, GTK_STOCK_INFO }, -#else - { PIDGIN_STOCK_INFO, "buttons", "info.png" }, -#endif }; static const GtkStockItem stock_items[] = @@ -411,11 +391,9 @@ static void reload_settings(void) { -#if GTK_CHECK_VERSION(2,4,0) GtkSettings *setting = NULL; setting = gtk_settings_get_default(); gtk_rc_reset_styles(setting); -#endif } /*****************************************************************************
--- a/pidgin/pidgintooltip.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/pidgintooltip.c Sun Aug 23 15:33:52 2009 +0000 @@ -119,9 +119,7 @@ tipwindow = gtk_window_new(GTK_WINDOW_POPUP); name = gtk_window_get_title(GTK_WINDOW(pidgin_tooltip.widget)); -#if GTK_CHECK_VERSION(2,10,0) gtk_window_set_type_hint(GTK_WINDOW(tipwindow), GDK_WINDOW_TYPE_HINT_TOOLTIP); -#endif gtk_widget_set_app_paintable(tipwindow, TRUE); gtk_window_set_title(GTK_WINDOW(tipwindow), name ? name : _("Pidgin Tooltip")); gtk_window_set_resizable(GTK_WINDOW(tipwindow), FALSE); @@ -136,41 +134,26 @@ { int sig; int scr_w, scr_h, x, y, dy; -#if GTK_CHECK_VERSION(2,2,0) int mon_num; GdkScreen *screen = NULL; -#endif GdkRectangle mon_size; GtkWidget *tipwindow = pidgin_tooltip.tipwindow; -#if GTK_CHECK_VERSION(2,2,0) gdk_display_get_pointer(gdk_display_get_default(), &screen, &x, &y, NULL); mon_num = gdk_screen_get_monitor_at_point(screen, x, y); gdk_screen_get_monitor_geometry(screen, mon_num, &mon_size); scr_w = mon_size.width + mon_size.x; scr_h = mon_size.height + mon_size.y; -#else - scr_w = gdk_screen_width(); - scr_h = gdk_screen_height(); - gdk_window_get_pointer(NULL, &x, &y, NULL); - mon_size.x = 0; - mon_size.y = 0; -#endif -#if GTK_CHECK_VERSION(2,4,0) dy = gdk_display_get_default_cursor_size(gdk_display_get_default()) / 2; -#else - dy = 0; -#endif -#if GTK_CHECK_VERSION(2,2,0) if (w > mon_size.width) w = mon_size.width - 10; if (h > mon_size.height) h = mon_size.height - 10; -#endif + x -= ((w >> 1) + 4); if ((y + h + 4) > scr_h)
--- a/pidgin/plugins/gestures/gestures.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/plugins/gestures/gestures.c Sun Aug 23 15:33:52 2009 +0000 @@ -57,11 +57,7 @@ { int count, current; -#if GTK_CHECK_VERSION(2,2,0) count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)); -#else - count = g_list_length(GTK_NOTEBOOK(win->notebook)->children); -#endif current = gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook)); if (dir == GTK_DIR_LEFT)
--- a/pidgin/plugins/pidginrc.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/plugins/pidginrc.c Sun Aug 23 15:33:52 2009 +0000 @@ -198,17 +198,13 @@ purplerc_make_changes(void) { GString *str = make_gtkrc_string(); -#if GTK_CHECK_VERSION(2,4,0) GtkSettings *setting = NULL; -#endif gtk_rc_parse_string(str->str); g_string_free(str, TRUE); -#if GTK_CHECK_VERSION(2,4,0) setting = gtk_settings_get_default(); gtk_rc_reset_styles(setting); -#endif } static void
--- a/pidgin/plugins/spellchk.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/plugins/spellchk.c Sun Aug 23 15:33:52 2009 +0000 @@ -2081,24 +2081,11 @@ g_string_free(data, TRUE); } -#if !GTK_CHECK_VERSION(2,2,0) -static void -count_selected_helper(GtkTreeModel *model, GtkTreePath *path, - GtkTreeIter *iter, gpointer user_data) -{ - (*(gint *)user_data)++; -} -#endif - static void on_selection_changed(GtkTreeSelection *sel, gpointer data) { gint num_selected; -#if GTK_CHECK_VERSION(2,2,0) num_selected = gtk_tree_selection_count_selected_rows(sel); -#else - gtk_tree_selection_selected_foreach(sel, count_selected_helper, &num_selected); -#endif gtk_widget_set_sensitive((GtkWidget*)data, (num_selected > 0)); }
--- a/pidgin/plugins/xmppconsole.c Sun Aug 23 15:26:13 2009 +0000 +++ b/pidgin/plugins/xmppconsole.c Sun Aug 23 15:33:52 2009 +0000 @@ -26,9 +26,6 @@ #include "xmlnode.h" #include "gtkimhtml.h" -#if !GTK_CHECK_VERSION(2,4,0) -#include "pidgincombobox.h" -#endif #include "gtkutils.h" typedef struct { @@ -734,9 +731,7 @@ GtkTextBuffer *buffer; GtkWidget *toolbar; GList *connections; -#if GTK_CHECK_VERSION(2,4,0) GtkToolItem *button; -#endif if (console) { gtk_window_present(GTK_WINDOW(console->window)); @@ -783,32 +778,17 @@ gtk_container_add(GTK_CONTAINER(sw), console->imhtml); toolbar = gtk_toolbar_new(); -#if GTK_CHECK_VERSION(2,4,0) button = gtk_tool_button_new(NULL, "<iq/>"); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(iq_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); -#else - gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "<iq/>", - _("Insert an <iq/> stanza."), "foo", NULL, GTK_SIGNAL_FUNC(iq_clicked_cb), NULL); -#endif -#if GTK_CHECK_VERSION(2,4,0) button = gtk_tool_button_new(NULL, "<presence/>"); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(presence_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); -#else - gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "<presence/>", - _("Insert a <presence/> stanza."), NULL, gtk_label_new(NULL), GTK_SIGNAL_FUNC(presence_clicked_cb), NULL); -#endif -#if GTK_CHECK_VERSION(2,4,0) button = gtk_tool_button_new(NULL, "<message/>"); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(message_clicked_cb), NULL); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(button)); -#else - gtk_toolbar_append_item(GTK_TOOLBAR(toolbar), "<message/>", - _("Insert a <message/> stanza."), "foo", gtk_label_new(NULL), GTK_SIGNAL_FUNC(message_clicked_cb), NULL); -#endif gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);