Mercurial > pidgin
changeset 32581:0743266f682e
propagate from branch 'im.pidgin.pidgin' (head 067d0354b67f513d4a79dc6c04b0bf85a01e02bc)
to branch 'im.pidgin.cpw.qulogic.gtk3' (head 75031623468183fc6b25c21efcd218470177ff49)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 25 Jul 2009 20:46:43 +0000 |
parents | b55fb0a1b087 (current diff) 08b6fd5e36ae (diff) |
children | 816f62c582d9 |
files | libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo.h pidgin/gtkblist.c pidgin/gtkconv.c pidgin/gtkprefs.c pidgin/gtkrequest.c pidgin/pixmaps/dialogs/64/scalable/auth.svg pidgin/pixmaps/dialogs/64/scalable/cool.svg pidgin/pixmaps/dialogs/64/scalable/dialog.svg pidgin/pixmaps/dialogs/64/scalable/error.svg pidgin/pixmaps/dialogs/64/scalable/info.svg pidgin/pixmaps/dialogs/64/scalable/mail.svg pidgin/pixmaps/dialogs/64/scalable/question.svg pidgin/pixmaps/dialogs/64/scalable/warning.svg pidgin/pixmaps/emblems/16/scalable/aol-client.svg pidgin/pixmaps/emblems/16/scalable/birthday.svg pidgin/pixmaps/emblems/16/scalable/blocked.svg pidgin/pixmaps/emblems/16/scalable/bot.svg pidgin/pixmaps/emblems/16/scalable/external.svg pidgin/pixmaps/emblems/16/scalable/female.svg pidgin/pixmaps/emblems/16/scalable/free-for-chat.svg pidgin/pixmaps/emblems/16/scalable/game.svg pidgin/pixmaps/emblems/16/scalable/male.svg pidgin/pixmaps/emblems/16/scalable/mobile.svg pidgin/pixmaps/emblems/16/scalable/music.svg pidgin/pixmaps/emblems/16/scalable/not-authorized.svg pidgin/pixmaps/emblems/16/scalable/qq-member.svg pidgin/pixmaps/emblems/16/scalable/secure.svg pidgin/pixmaps/emblems/16/scalable/unavailable.svg pidgin/pixmaps/emblems/16/scalable/video.svg pidgin/pixmaps/emblems/16/scalable/voice.svg pidgin/pixmaps/icons/hicolor/48x48/apps/scalable/pidgin.svg pidgin/pixmaps/protocols/48/scalable/aim.svg pidgin/pixmaps/protocols/48/scalable/bonjour.svg pidgin/pixmaps/protocols/48/scalable/gadu-gadu.svg pidgin/pixmaps/protocols/48/scalable/google-talk.svg pidgin/pixmaps/protocols/48/scalable/icq.svg pidgin/pixmaps/protocols/48/scalable/irc.svg pidgin/pixmaps/protocols/48/scalable/jabber.svg pidgin/pixmaps/protocols/48/scalable/meanwhile.svg pidgin/pixmaps/protocols/48/scalable/msn.svg pidgin/pixmaps/protocols/48/scalable/novell.svg pidgin/pixmaps/protocols/48/scalable/qq.svg pidgin/pixmaps/protocols/48/scalable/silc.svg pidgin/pixmaps/protocols/48/scalable/simple.svg pidgin/pixmaps/protocols/48/scalable/yahoo.svg pidgin/pixmaps/protocols/48/scalable/zephyr.svg |
diffstat | 14 files changed, 500 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkblist.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkblist.c Sat Jul 25 20:46:43 2009 +0000 @@ -5365,8 +5365,28 @@ headline_style_set (GtkWidget *widget, GtkStyle *prev_style) { + GtkStyle *style; +#if GTK_CHECK_VERSION(2,12,0) + GtkWidget *window; + + if (gtkblist->changing_style) + return; + + /* This is a hack needed to use the tooltip background colour */ + window = gtk_window_new(GTK_WINDOW_POPUP); + gtk_widget_set_name(window, "gtk-tooltip"); + gtk_widget_ensure_style(window); + style = gtk_widget_get_style(window); + + gtkblist->changing_style = TRUE; + gtk_widget_set_style(gtkblist->headline_hbox, style); + gtkblist->changing_style = FALSE; + + gtk_widget_destroy(window); + + gtk_widget_queue_draw(gtkblist->headline_hbox); +#else GtkTooltips *tooltips; - GtkStyle *style; if (gtkblist->changing_style) return; @@ -5391,6 +5411,7 @@ gtkblist->changing_style = FALSE; g_object_unref (tooltips); +#endif } /******************************************/
--- a/pidgin/gtkconv.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkconv.c Sat Jul 25 20:46:43 2009 +0000 @@ -5249,7 +5249,9 @@ gtkconv->send_history = g_list_append(NULL, NULL); /* Setup some initial variables. */ +#if !GTK_CHECK_VERSION(2,12,0) gtkconv->tooltips = gtk_tooltips_new(); +#endif gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; gtkconv->unseen_count = 0; @@ -5442,7 +5444,9 @@ g_free(gtkconv->u.chat); } +#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); +#endif gtkconv->send_history = g_list_first(gtkconv->send_history); g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL); @@ -6641,8 +6645,13 @@ topic = purple_conv_chat_get_topic(chat); gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(gtkchat->topic_text, + topic ? topic : ""); +#else gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, topic ? topic : "", NULL); +#endif } } @@ -9418,8 +9427,12 @@ g_signal_connect(G_OBJECT(gtkconv->close), "leave-notify-event", G_CALLBACK(close_button_left_cb), close_image); gtk_widget_show(close_image); gtk_container_add(GTK_CONTAINER(gtkconv->close), close_image); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation")); +#else gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close, _("Close conversation"), NULL); +#endif g_signal_connect(G_OBJECT(gtkconv->close), "button-press-event", G_CALLBACK(close_conv_cb), gtkconv);
--- a/pidgin/gtkconv.h Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkconv.h Sat Jul 25 20:46:43 2009 +0000 @@ -122,7 +122,11 @@ gboolean make_sound; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr2; +#else GtkTooltips *tooltips; +#endif GtkWidget *tab_cont; GtkWidget *tabby;
--- a/pidgin/gtkdebug.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkdebug.c Sat Jul 25 20:46:43 2009 +0000 @@ -43,6 +43,19 @@ #include <gdk/gdkkeysyms.h> +/* TODO: I'm too lazy to change all these until we bump required GTK+ version */ +#if GTK_CHECK_VERSION(2,4,0) +#undef GTK_TOGGLE_BUTTON +#undef gtk_toggle_button_get_active +#undef gtk_toggle_button_set_active +#undef GtkToggleButton + +#define GTK_TOGGLE_BUTTON GTK_TOGGLE_TOOL_BUTTON +#define gtk_toggle_button_get_active gtk_toggle_tool_button_get_active +#define gtk_toggle_button_set_active gtk_toggle_tool_button_set_active +#define GtkToggleButton GtkToggleToolButton +#endif + typedef struct { GtkWidget *window; @@ -677,9 +690,16 @@ GtkWidget *vbox; GtkWidget *toolbar; GtkWidget *frame; - GtkWidget *image; gint width, height; void *handle; +#if GTK_CHECK_VERSION(2,4,0) + GtkToolItem *item; +#if !GTK_CHECK_VERSION(2,12,0) + GtkTooltips *tooltips; +#endif +#else + GtkWidget *image; +#endif win = g_new0(DebugWindow, 1); @@ -719,7 +739,12 @@ if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) { /* Setup our top button bar thingie. */ toolbar = gtk_toolbar_new(); +#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,12,0) + tooltips = gtk_tooltips_new(); +#endif +#if !GTK_CHECK_VERSION(2,14,0) gtk_toolbar_set_tooltips(GTK_TOOLBAR(toolbar), TRUE); +#endif #if GTK_CHECK_VERSION(2,4,0) gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), TRUE); #endif @@ -736,36 +761,101 @@ #ifndef HAVE_REGEX_H /* Find button */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Find")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Find"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND, _("Find"), NULL, G_CALLBACK(find_cb), win, -1); +#endif #endif /* HAVE_REGEX_H */ /* Save */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Save")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Save"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE, _("Save"), NULL, G_CALLBACK(save_cb), win, -1); +#endif /* Clear button */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Clear")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Clear"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR, _("Clear"), NULL, G_CALLBACK(clear_cb), win, -1); +#endif +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif /* Pause */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(item, _("Pause")); +#else + gtk_tool_item_set_tooltip(item, tooltips, _("Pause"), NULL); +#endif + g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU); gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, NULL, _("Pause"), _("Pause"), NULL, image, G_CALLBACK(pause_cb), win); +#endif #ifdef HAVE_REGEX_H /* regex stuff */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif /* regex toggle button */ +#if GTK_CHECK_VERSION(2,4,0) + win->filter = GTK_WIDGET(gtk_toggle_tool_button_new()); + gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter")); +#if GTK_CHECK_VERSION(2,12,0) + gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(win->filter), _("Filter")); +#else + gtk_tooltips_set_tip(tooltips, win->filter, _("Filter"), NULL); +#endif + g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter)); +#else win->filter = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_TOGGLEBUTTON, @@ -773,6 +863,8 @@ NULL, NULL, G_CALLBACK(regex_filter_toggled_cb), win); +#endif + /* we purposely disable the toggle button here in case * /purple/gtk/debug/expression has an empty string. If it does not have * an empty string, the change signal will get called and make the @@ -786,10 +878,21 @@ /* regex entry */ win->expression = gtk_entry_new(); +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(win->expression, _("Right click for more options.")); +#else + gtk_tooltips_set_tip(tooltips, win->expression, _("Right click for more options."), NULL); +#endif + gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression)); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, win->expression, NULL, _("Right click for more options."), NULL, NULL, NULL, NULL); +#endif /* this needs to be before the text is set from the pref if we want it * to colorize a stored expression. */ @@ -815,18 +918,39 @@ #endif /* HAVE_REGEX_H */ +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_separator_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1); +#endif +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level "))); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")), NULL, _("Select the debug filter level."), NULL, NULL, NULL, NULL); - +#endif win->filterlevel = gtk_combo_box_new_text(); +#if GTK_CHECK_VERSION(2,4,0) + item = gtk_tool_item_new(); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level.")); +#else + gtk_tooltips_set_tip(tooltips, win->filterlevel, _("Select the debug filter level."), NULL); +#endif + gtk_container_add(GTK_CONTAINER(item), win->filterlevel); + gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item)); +#else gtk_toolbar_append_element(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel, NULL, _("Select the debug filter level."), NULL, NULL, NULL, NULL); +#endif gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All")); gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc")); gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info"));
--- a/pidgin/gtkdocklet-x11.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkdocklet-x11.c Sat Jul 25 20:46:43 2009 +0000 @@ -40,7 +40,9 @@ /* globals */ static EggTrayIcon *docklet = NULL; static GtkWidget *image = NULL; +#if !GTK_CHECK_VERSION(2,12,0) static GtkTooltips *tooltips = NULL; +#endif static GdkPixbuf *blank_icon = NULL; static int embed_timeout = 0; static int docklet_height = 0; @@ -192,6 +194,13 @@ static void docklet_x11_set_tooltip(gchar *tooltip) { +#if GTK_CHECK_VERSION(2,12,0) + if (tooltip) { + gtk_widget_set_tooltip_text(image->parent, tooltip); + } else { + gtk_widget_set_tooltip_text(image->parent, ""); /* NULL? */ + } +#else if (!tooltips) tooltips = gtk_tooltips_new(); @@ -203,6 +212,7 @@ gtk_tooltips_set_tip(tooltips, image->parent, "", NULL); gtk_tooltips_disable(tooltips); } +#endif } #if GTK_CHECK_VERSION(2,2,0)
--- a/pidgin/gtkimhtmltoolbar.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkimhtmltoolbar.c Sat Jul 25 20:46:43 2009 +0000 @@ -669,7 +669,11 @@ g_object_set_data(G_OBJECT(button), "smiley_text", face); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(insert_smiley_text), toolbar); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, face); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL); +#endif /* these look really weird with borders */ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); @@ -683,7 +687,11 @@ g_snprintf(tip, sizeof(tip), _("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"), face); +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, tip); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL); +#endif gtk_widget_set_sensitive(button, FALSE); } else if (psmiley) { /* Remove the button if the smiley is destroyed */ @@ -1147,7 +1155,9 @@ } g_free(toolbar->sml); +#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(toolbar->tooltips)); +#endif menu = g_object_get_data(object, "font_menu"); if (menu) @@ -1244,7 +1254,11 @@ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(buttons[iter].callback), toolbar); *(buttons[iter].button) = button; +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, buttons[iter].tooltip); +#else gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL); +#endif } else button = gtk_vseparator_new(); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); @@ -1334,7 +1348,9 @@ toolbar->smiley_dialog = NULL; toolbar->image_dialog = NULL; +#if !GTK_CHECK_VERSION(2,12,0) toolbar->tooltips = gtk_tooltips_new(); +#endif gtk_box_set_spacing(GTK_BOX(toolbar), 3);
--- a/pidgin/gtkimhtmltoolbar.h Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkimhtmltoolbar.h Sat Jul 25 20:46:43 2009 +0000 @@ -46,7 +46,11 @@ GtkWidget *imhtml; +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr1; +#else GtkTooltips *tooltips; +#endif GtkWidget *bold; GtkWidget *italic;
--- a/pidgin/gtkmenutray.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkmenutray.c Sat Jul 25 20:46:43 2009 +0000 @@ -104,9 +104,11 @@ gtk_widget_destroy(GTK_WIDGET(tray->tray)); #endif +#if !GTK_CHECK_VERSION(2,12,0) if (tray->tooltips) { gtk_object_sink(GTK_OBJECT(tray->tooltips)); } +#endif G_OBJECT_CLASS(parent_class)->finalize(obj); } @@ -244,13 +246,15 @@ void pidgin_menu_tray_set_tooltip(PidginMenuTray *menu_tray, GtkWidget *widget, const char *tooltip) { +#if !GTK_CHECK_VERSION(2,12,0) if (!menu_tray->tooltips) menu_tray->tooltips = gtk_tooltips_new(); +#endif /* Should we check whether widget is a child of menu_tray? */ /* - * If the widget does not have it's own window, then it + * If the widget does not have its own window, then it * must have automatically been added to an event box * when it was added to the menu tray. If this is the * case, we want to set the tooltip on the widget's parent, @@ -259,6 +263,10 @@ if (GTK_WIDGET_NO_WINDOW(widget)) widget = widget->parent; +#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(widget, tooltip); +#else gtk_tooltips_set_tip(menu_tray->tooltips, widget, tooltip, NULL); +#endif }
--- a/pidgin/gtkmenutray.h Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkmenutray.h Sat Jul 25 20:46:43 2009 +0000 @@ -40,7 +40,11 @@ struct _PidginMenuTray { GtkMenuItem gparent; /**< The parent instance */ GtkWidget *tray; /**< The tray */ +#if GTK_CHECK_VERSION(2,12,0) + gpointer depr1; +#else GtkTooltips *tooltips; /**< Tooltips */ +#endif }; /** A PidginMenuTrayClass */
--- a/pidgin/gtkprefs.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkprefs.c Sat Jul 25 20:46:43 2009 +0000 @@ -176,14 +176,52 @@ return pidgin_add_widget_to_vbox(GTK_BOX(page), title, sg, entry, TRUE, NULL); } +/* TODO: Maybe move this up somewheres... */ +enum { + PREF_DROPDOWN_TEXT, + PREF_DROPDOWN_VALUE, + PREF_DROPDOWN_COUNT +}; static void dropdown_set(GObject *w, const char *key) { const char *str_value; int int_value; + gboolean bool_value; PurplePrefType type; +#if GTK_CHECK_VERSION(2,4,0) + GtkTreeIter iter; + GtkTreeModel *tree_model; + + tree_model = gtk_combo_box_get_model(GTK_COMBO_BOX(w)); + gtk_combo_box_get_active_iter(GTK_COMBO_BOX(w), &iter); + + type = GPOINTER_TO_INT(g_object_get_data(w, "type")); + + if (type == PURPLE_PREF_INT) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &int_value, + -1); + + purple_prefs_set_int(key, int_value); + } + else if (type == PURPLE_PREF_STRING) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &str_value, + -1); + + purple_prefs_set_string(key, str_value); + } + else if (type == PURPLE_PREF_BOOLEAN) { + gtk_tree_model_get(tree_model, &iter, + PREF_DROPDOWN_VALUE, &bool_value, + -1); + + purple_prefs_set_bool(key, bool_value); + } +#else type = GPOINTER_TO_INT(g_object_get_data(w, "type")); if (type == PURPLE_PREF_INT) { @@ -197,64 +235,129 @@ purple_prefs_set_string(key, str_value); } else if (type == PURPLE_PREF_BOOLEAN) { - purple_prefs_set_bool(key, - GPOINTER_TO_INT(g_object_get_data(w, "value"))); + bool_value = (gboolean)GPOINTER_TO_INT(g_object_get_data(w, "value")); + purple_prefs_set_bool(key, bool_value); } +#endif } GtkWidget * pidgin_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, PurplePrefType type, const char *key, GList *menuitems) { - GtkWidget *dropdown, *opt, *menu; + GtkWidget *dropdown; GtkWidget *label = NULL; gchar *text; const char *stored_str = NULL; int stored_int = 0; + gboolean stored_bool = FALSE; int int_value = 0; const char *str_value = NULL; + gboolean bool_value = FALSE; +#if GTK_CHECK_VERSION(2,4,0) + GtkListStore *store; + GtkTreeIter iter; + GtkTreeIter active; + GtkCellRenderer *renderer; + + g_return_val_if_fail(menuitems != NULL, NULL); + + if (type == PURPLE_PREF_INT) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_INT); + stored_int = purple_prefs_get_int(key); + } else if (type == PURPLE_PREF_STRING) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_STRING); + stored_str = purple_prefs_get_string(key); + } else if (type == PURPLE_PREF_BOOLEAN) { + store = gtk_list_store_new(PREF_DROPDOWN_COUNT, G_TYPE_STRING, G_TYPE_BOOLEAN); + stored_bool = purple_prefs_get_bool(key); + } + + dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + g_object_set_data(G_OBJECT(dropdown), "type", GINT_TO_POINTER(type)); + + while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) { + menuitems = g_list_next(menuitems); + g_return_val_if_fail(menuitems != NULL, NULL); + + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_TEXT, text, + -1); + + if (type == PURPLE_PREF_INT) { + int_value = GPOINTER_TO_INT(menuitems->data); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, int_value, + -1); + } + else if (type == PURPLE_PREF_STRING) { + str_value = (const char *)menuitems->data; + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, str_value, + -1); + } + else if (type == PURPLE_PREF_BOOLEAN) { + bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data); + gtk_list_store_set(store, &iter, + PREF_DROPDOWN_VALUE, bool_value, + -1); + } + + if ((type == PURPLE_PREF_INT && stored_int == int_value) || + (type == PURPLE_PREF_STRING && stored_str != NULL && + !strcmp(stored_str, str_value)) || + (type == PURPLE_PREF_BOOLEAN && + (stored_bool == bool_value))) { + + active = iter; + } + + menuitems = g_list_next(menuitems); + } + + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "text", 0, + NULL); + + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dropdown), &active); + + g_signal_connect(G_OBJECT(dropdown), "changed", + G_CALLBACK(dropdown_set), (char *)key); + +#else + GtkWidget *opt, *menu; int o = 0; g_return_val_if_fail(menuitems != NULL, NULL); -#if 0 /* GTK_CHECK_VERSION(2,4,0) */ - if(type == PURPLE_PREF_INT) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); - else if(type == PURPLE_PREF_STRING) - model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); - dropdown = gtk_combo_box_new_with_model(model); -#else dropdown = gtk_option_menu_new(); menu = gtk_menu_new(); -#endif if (type == PURPLE_PREF_INT) stored_int = purple_prefs_get_int(key); else if (type == PURPLE_PREF_STRING) stored_str = purple_prefs_get_string(key); - - while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { + else if (type == PURPLE_PREF_BOOLEAN) + stored_bool = purple_prefs_get_bool(key); + + while (menuitems != NULL && (text = (char *)menuitems->data) != NULL) { menuitems = g_list_next(menuitems); g_return_val_if_fail(menuitems != NULL, NULL); opt = gtk_menu_item_new_with_label(text); g_object_set_data(G_OBJECT(opt), "type", GINT_TO_POINTER(type)); - - if (type == PURPLE_PREF_INT) { + g_object_set_data(G_OBJECT(opt), "value", menuitems->data); + + if (type == PURPLE_PREF_INT) int_value = GPOINTER_TO_INT(menuitems->data); - g_object_set_data(G_OBJECT(opt), "value", - GINT_TO_POINTER(int_value)); - } - else if (type == PURPLE_PREF_STRING) { + else if (type == PURPLE_PREF_STRING) str_value = (const char *)menuitems->data; - - g_object_set_data(G_OBJECT(opt), "value", (char *)str_value); - } - else if (type == PURPLE_PREF_BOOLEAN) { - g_object_set_data(G_OBJECT(opt), "value", - menuitems->data); - } + else if (type == PURPLE_PREF_BOOLEAN) + bool_value = (gboolean)GPOINTER_TO_INT(menuitems->data); g_signal_connect(G_OBJECT(opt), "activate", G_CALLBACK(dropdown_set), (char *)key); @@ -266,7 +369,7 @@ (type == PURPLE_PREF_STRING && stored_str != NULL && !strcmp(stored_str, str_value)) || (type == PURPLE_PREF_BOOLEAN && - (purple_prefs_get_bool(key) == GPOINTER_TO_INT(menuitems->data)))) { + (stored_bool == bool_value))) { gtk_menu_set_active(GTK_MENU(menu), o); } @@ -278,6 +381,8 @@ gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); +#endif + pidgin_add_widget_to_vbox(GTK_BOX(box), title, NULL, dropdown, FALSE, &label); return label;
--- a/pidgin/gtkprivacy.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkprivacy.c Sat Jul 25 20:46:43 2009 +0000 @@ -220,7 +220,11 @@ for (i = 0; i < menu_entry_count; i++) { if (menu_entries[i].num == account->perm_deny) { +#if GTK_CHECK_VERSION(2,4,0) + gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i); +#else gtk_option_menu_set_history(GTK_OPTION_MENU(dialog->type_menu), i); +#endif break; } } @@ -233,10 +237,17 @@ * TODO: Setting the permit/deny setting needs to go through privacy.c * Even better: the privacy API needs to not suck. */ +#if GTK_CHECK_VERSION(2,4,0) +static void +type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog) +{ + int new_type = menu_entries[gtk_combo_box_get_active(combo)].num; +#else static void type_changed_cb(GtkOptionMenu *optmenu, PidginPrivacyDialog *dialog) { int new_type = menu_entries[gtk_option_menu_get_history(optmenu)].num; +#endif dialog->account->perm_deny = new_type; serv_set_permit_deny(purple_account_get_connection(dialog->account)); @@ -343,7 +354,9 @@ GtkWidget *button; GtkWidget *dropdown; GtkWidget *label; +#if !GTK_CHECK_VERSION(2,4,0) GtkWidget *menu; +#endif int selected = 0; int i; @@ -372,6 +385,24 @@ dialog->account = pidgin_account_option_menu_get_selected(dropdown); /* Add the drop-down list with the allow/block types. */ +#if GTK_CHECK_VERSION(2,4,0) + dialog->type_menu = gtk_combo_box_new_text(); + gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); + gtk_widget_show(dialog->type_menu); + + for (i = 0; i < menu_entry_count; i++) { + gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->type_menu), + _(menu_entries[i].text)); + + if (menu_entries[i].num == dialog->account->perm_deny) + selected = i; + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), selected); + + g_signal_connect(G_OBJECT(dialog->type_menu), "changed", + G_CALLBACK(type_changed_cb), dialog); +#else dialog->type_menu = gtk_option_menu_new(); gtk_box_pack_start(GTK_BOX(vbox), dialog->type_menu, FALSE, FALSE, 0); gtk_widget_show(dialog->type_menu); @@ -391,6 +422,7 @@ g_signal_connect(G_OBJECT(dialog->type_menu), "changed", G_CALLBACK(type_changed_cb), dialog); +#endif /* Build the treeview for the allow list. */ dialog->allow_widget = build_allow_list(dialog); @@ -421,7 +453,11 @@ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog); dialog->close_button = button; +#if GTK_CHECK_VERSION(2,4,0) + type_changed_cb(GTK_COMBO_BOX(dialog->type_menu), dialog); +#else type_changed_cb(GTK_OPTION_MENU(dialog->type_menu), dialog); +#endif #if 0 if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { gtk_widget_show(dialog->allow_widget);
--- a/pidgin/gtkrequest.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtkrequest.c Sat Jul 25 20:46:43 2009 +0000 @@ -202,12 +202,21 @@ gtk_toggle_button_get_active(button)); } +#if GTK_CHECK_VERSION(2,4,0) +static void +field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field) +{ + purple_request_field_choice_set_value(field, + gtk_combo_box_get_active(menu)); +} +#else static void field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field) { purple_request_field_choice_set_value(field, gtk_option_menu_get_history(menu)); } +#endif static void field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field) @@ -874,6 +883,21 @@ if (num_labels > 5) { +#if GTK_CHECK_VERSION(2,4,0) + widget = gtk_combo_box_new_text(); + + for (l = labels; l != NULL; l = l->next) + { + const char *text = l->data; + gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text); + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), + purple_request_field_choice_get_default_value(field)); + + g_signal_connect(G_OBJECT(widget), "changed", + G_CALLBACK(field_choice_menu_cb), field); +#else GtkWidget *menu; GtkWidget *item; @@ -898,6 +922,7 @@ g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(field_choice_menu_cb), field); +#endif } else {
--- a/pidgin/gtksavedstatuses.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/gtksavedstatuses.c Sat Jul 25 20:46:43 2009 +0000 @@ -119,7 +119,11 @@ gchar *original_title; GtkEntry *title; +#if GTK_CHECK_VERSION(2,4,0) + GtkComboBox *type; +#else GtkOptionMenu *type; +#endif GtkIMHtml *message; } StatusEditor; @@ -780,7 +784,11 @@ return; } +#if GTK_CHECK_VERSION(2,4,0) + type = gtk_combo_box_get_active(dialog->type) + (PURPLE_STATUS_UNSET + 1); +#else type = gtk_option_menu_get_history(dialog->type) + (PURPLE_STATUS_UNSET + 1); +#endif message = gtk_imhtml_get_markup(dialog->message); unformatted = purple_markup_strip_html(message); @@ -874,6 +882,64 @@ gtk_widget_set_sensitive(GTK_WIDGET(dialog->save_button), (*text != '\0')); } +#if GTK_CHECK_VERSION(2,4,0) + +enum { + STATUS_MENU_STOCK_ICON, + STATUS_MENU_NAME, + STATUS_MENU_COUNT +}; + +static GtkWidget * +create_status_type_menu(PurpleStatusPrimitive type) +{ + int i; + GtkWidget *dropdown; + GtkListStore *store; + GtkTreeIter iter; + GtkCellRenderer *renderer; + + store = gtk_list_store_new(STATUS_MENU_COUNT, G_TYPE_STRING, G_TYPE_STRING); + + for (i = PURPLE_STATUS_UNSET + 1; i < PURPLE_STATUS_NUM_PRIMITIVES; i++) + { + if (i == PURPLE_STATUS_MOBILE || i == PURPLE_STATUS_TUNE) + /* + * Special-case these. They're intended to be independent + * status types, so don't show them in the list. + */ + continue; + + gtk_list_store_append(store, &iter); + /* TODO: how's this get the right size (since it seems to work fine)? */ + gtk_list_store_set(store, &iter, + STATUS_MENU_STOCK_ICON, get_stock_icon_from_primitive(i), + STATUS_MENU_NAME, purple_primitive_get_name_from_type(i), + -1); + } + + dropdown = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); + + renderer = gtk_cell_renderer_pixbuf_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, FALSE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "stock-id", STATUS_MENU_STOCK_ICON, + NULL); + + renderer = gtk_cell_renderer_text_new(); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dropdown), renderer, TRUE); + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(dropdown), renderer, + "text", STATUS_MENU_NAME, + NULL); + + gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown), + type - (PURPLE_STATUS_UNSET + 1)); + + return dropdown; +} + +#else + static GtkWidget * create_stock_item(const gchar *str, const gchar *icon) { @@ -881,7 +947,7 @@ GtkWidget *label = gtk_label_new_with_mnemonic(str); GtkWidget *hbox = gtk_hbox_new(FALSE, 4); GtkIconSize icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); - GtkWidget *image = gtk_image_new_from_stock(icon, icon_size);; + GtkWidget *image = gtk_image_new_from_stock(icon, icon_size); gtk_widget_show(label); gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); @@ -926,6 +992,8 @@ return dropdown; } +#endif + static void edit_substatus(StatusEditor *status_editor, PurpleAccount *account); static void @@ -1191,7 +1259,11 @@ dropdown = create_status_type_menu(purple_savedstatus_get_type(saved_status)); else dropdown = create_status_type_menu(PURPLE_STATUS_AWAY); +#if GTK_CHECK_VERSION(2,4,0) + dialog->type = GTK_COMBO_BOX(dropdown); +#else dialog->type = GTK_OPTION_MENU(dropdown); +#endif pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("_Status:"), sg, dropdown, TRUE, NULL); /* Status message */
--- a/pidgin/plugins/gestures/gestures.c Sat Jul 25 08:26:47 2009 +0000 +++ b/pidgin/plugins/gestures/gestures.c Sat Jul 25 20:46:43 2009 +0000 @@ -149,6 +149,15 @@ } #if 0 +#if GTK_CHECK_VERSION(2,4,0) +static void +mouse_button_menu_cb(GtkComboBox *opt, gpointer data) +{ + int button = gtk_combo_box_get_active(opt); + + gstroke_set_mouse_button(button + 2); +} +#else static void mouse_button_menu_cb(GtkMenuItem *item, gpointer data) { @@ -157,6 +166,7 @@ gstroke_set_mouse_button(button + 2); } #endif +#endif static void toggle_draw_cb(GtkToggleButton *toggle, gpointer data) @@ -224,8 +234,10 @@ GtkWidget *toggle; #if 0 GtkWidget *opt; +#if GTK_CHECK_VERSION(2,4,0) GtkWidget *menu, *item; #endif +#endif /* Outside container */ ret = gtk_vbox_new(FALSE, 18); @@ -235,6 +247,19 @@ vbox = pidgin_make_frame(ret, _("Mouse Gestures Configuration")); #if 0 +#if GTK_CHECK_VERSION(2,4,0) + /* Mouse button drop-down menu */ + opt = gtk_combo_box_new_text(); + + gtk_combo_box_append_text(_("Middle mouse button")); + gtk_combo_box_append_text(_("Right mouse button")); + g_signal_connect(G_OBJECT(opt), "changed", + G_CALLBACK(mouse_button_menu_cb), NULL); + + gtk_box_pack_start(GTK_BOX(vbox), opt, FALSE, FALSE, 0); + gtk_combo_box_set_active(GTK_COMBO_BOX(opt), + gstroke_get_mouse_button() - 2); +#else /* Mouse button drop-down menu */ menu = gtk_menu_new(); opt = gtk_option_menu_new(); @@ -254,6 +279,7 @@ gtk_option_menu_set_history(GTK_OPTION_MENU(opt), gstroke_get_mouse_button() - 2); #endif +#endif /* "Visual gesture display" checkbox */ toggle = gtk_check_button_new_with_mnemonic(_("_Visual gesture display"));