--- a/pidgin/gtkblist.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkblist.c Mon Aug 22 22:39:32 2011 +0000
@@ -124,7 +124,8 @@
#define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
((PidginBuddyListPrivate *)((list)->priv))
-static GtkWidget *accountmenu = NULL;
+static guint accounts_merge_id; +static GtkActionGroup *accounts_action_group = NULL; static guint visibility_manager_count = 0;
static GdkVisibilityState gtk_blist_visibility = GDK_VISIBILITY_UNOBSCURED;
@@ -138,6 +139,9 @@
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);
+static guint sort_merge_id; +static GtkActionGroup *sort_action_group = NULL; static PidginBuddyList *gtkblist = NULL;
static GList *groups_tree(void);
@@ -148,7 +152,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);
-static const char *item_factory_translate_func (const char *path, gpointer func_data);
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);
@@ -242,7 +245,7 @@
/* check for visibility because when we aren't visible, this will *
* give us bogus (0,0) coordinates. - xOr */
- if (GTK_WIDGET_VISIBLE(w))
+ if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y);
return FALSE; /* carry on normally */
@@ -459,9 +462,9 @@
/* First, we find the contact to merge the rest of the buddies into.
- * This will be the contact with the most buddies in it; ties are broken
- * by which contact is higher in the list
+ * This will be the contact with the most buddies in it; ties are broken + * by which contact is higher in the list for (tmp = merges; tmp; tmp = tmp->next) {
PurpleBlistNode *node = tmp->data;
@@ -982,20 +985,23 @@
gtkblist = PIDGIN_BLIST(purple_get_blist());
blist_window = gtkblist ? GTK_WINDOW(gtkblist->window) : NULL;
+ /* TODO: set no separator in gtk+ 3... */ data->window = gtk_dialog_new_with_buttons(title,
- blist_window, GTK_DIALOG_NO_SEPARATOR,
+ blist_window, 0, NULL); gtk_window_set_transient_for(GTK_WINDOW(data->window), blist_window);
gtk_dialog_set_default_response(GTK_DIALOG(data->window), GTK_RESPONSE_OK);
gtk_container_set_border_width(GTK_CONTAINER(data->window), PIDGIN_HIG_BOX_SPACE);
gtk_window_set_resizable(GTK_WINDOW(data->window), FALSE);
- gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BORDER);
- gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), PIDGIN_HIG_BOX_SPACE);
+ gtk_box_set_spacing(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), + gtk_container_set_border_width(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), gtk_window_set_role(GTK_WINDOW(data->window), window_role);
hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(data->window)->vbox), hbox);
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(data->window))), gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
@@ -1058,7 +1064,7 @@
adjust = gtk_adjustment_new(pce->min, pce->min, pce->max,
input = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
@@ -1554,7 +1560,7 @@
pidgin_append_blist_node_move_to_menu(menu, (PurpleBlistNode *)contact);
if (node->parent && node->parent->child->next &&
- !sub && !contact_expanded) {
+ !sub && !contact_expanded) { pidgin_append_blist_node_privacy_menu(menu, node);
pidgin_new_item_from_stock(menu, _("_Alias..."), PIDGIN_STOCK_ALIAS,
@@ -1603,11 +1609,11 @@
pidgin_retrieve_user_info(buddy->account->gc, buddy->name);
gtk_blist_menu_alias_cb(tv, node);
path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
if (gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
@@ -1629,7 +1635,7 @@
gtk_tree_path_free(path);
path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
if (!gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path)) {
@@ -2012,64 +2018,70 @@
-static void pidgin_blist_buddy_details_cb(gpointer data, guint action, GtkWidget *item)
+static void gtk_blist_show_xfer_dialog_cb(GtkAction *item, gpointer data) + pidgin_xfer_dialog_show(NULL); +static void pidgin_blist_buddy_details_cb(GtkToggleAction *item, gpointer data) 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)));
+ gtk_toggle_action_get_active(item)); pidgin_clear_cursor(gtkblist->window);
-static void pidgin_blist_show_idle_time_cb(gpointer data, guint action, GtkWidget *item)
+static void pidgin_blist_show_idle_time_cb(GtkToggleAction *item, gpointer data) 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)));
+ gtk_toggle_action_get_active(item)); pidgin_clear_cursor(gtkblist->window);
-static void pidgin_blist_show_protocol_icons_cb(gpointer data, guint action, GtkWidget *item)
+static void pidgin_blist_show_protocol_icons_cb(GtkToggleAction *item, gpointer data) 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)
+ gtk_toggle_action_get_active(item)); +static void pidgin_blist_show_empty_groups_cb(GtkToggleAction *item, gpointer data) 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)));
+ gtk_toggle_action_get_active(item)); pidgin_clear_cursor(gtkblist->window);
-static void pidgin_blist_edit_mode_cb(gpointer callback_data, guint callback_action,
+static void pidgin_blist_edit_mode_cb(GtkToggleAction *checkitem, gpointer data) 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)));
+ gtk_toggle_action_get_active(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(item)->active);
+static void pidgin_blist_mute_sounds_cb(GtkToggleAction *item, gpointer data) + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", + gtk_toggle_action_get_active(item)); pidgin_blist_mute_pref_cb(const char *name, PurplePrefType type,
gconstpointer value, gpointer data)
- 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));
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, + "/BList/ToolsMenu/MuteSounds")), (gboolean)GPOINTER_TO_INT(value)); @@ -2081,7 +2093,7 @@
if(!strcmp(value, "none"))
- gtk_widget_set_sensitive(gtk_item_factory_get_widget(gtkblist->ift, N_("/Tools/Mute Sounds")), sensitive);
+ gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), sensitive); @@ -2238,9 +2250,9 @@
- if (data->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
+ GdkAtom target = gtk_selection_data_get_target(data); + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) { GtkTreeRowReference *ref = g_object_get_data(G_OBJECT(dc), "gtk-tree-view-source-row");
GtkTreePath *sourcerow = gtk_tree_row_reference_get_path(ref);
@@ -2256,9 +2268,7 @@
gtk_tree_path_free(sourcerow);
- else if (data->target == gdk_atom_intern("application/x-im-contact", FALSE))
+ } else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) { GtkTreeRowReference *ref;
@@ -2336,16 +2346,19 @@
static void pidgin_blist_drag_data_rcv_cb(GtkWidget *widget, GdkDragContext *dc, guint x, guint y,
GtkSelectionData *sd, guint info, guint t)
+ GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); if (gtkblist->drag_timeout) {
g_source_remove(gtkblist->drag_timeout);
gtkblist->drag_timeout = 0;
- if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && sd->data) {
+ if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE) && data) { PurpleBlistNode *n = NULL;
GtkTreePath *path = NULL;
GtkTreeViewDropPosition position;
- memcpy(&n, sd->data, sizeof(n));
+ memcpy(&n, data, sizeof(n)); if(gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(widget), x, y, &path, &position)) {
/* if we're here, I think it means the drop is ok */
@@ -2481,12 +2494,10 @@
gtk_tree_path_free(path);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
- else if (sd->target == gdk_atom_intern("application/x-im-contact",
+ gtk_drag_finish(dc, TRUE, (gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE), t); + } else if (target == gdk_atom_intern("application/x-im-contact", PurpleGroup *group = NULL;
GtkTreePath *path = NULL;
GtkTreeViewDropPosition position;
@@ -2521,7 +2532,7 @@
- if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
+ if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, &alias))
@@ -2545,9 +2556,10 @@
gtk_tree_path_free(path);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
- else if (sd->target == gdk_atom_intern("text/x-vcard", FALSE) && sd->data)
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + else if (target == gdk_atom_intern("text/x-vcard", FALSE) && data) PurpleGroup *group = NULL;
@@ -2580,10 +2592,11 @@
- result = parse_vcard((const gchar *)sd->data, group);
- gtk_drag_finish(dc, result, (dc->action == GDK_ACTION_MOVE), t);
- } else if (sd->target == gdk_atom_intern("text/uri-list", FALSE) && sd->data) {
+ result = parse_vcard((const gchar *) data, group); + gtk_drag_finish(dc, result, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + } else if (target == gdk_atom_intern("text/uri-list", FALSE) && data) { GtkTreePath *path = NULL;
GtkTreeViewDropPosition position;
@@ -2601,7 +2614,8 @@
if (PURPLE_BLIST_NODE_IS_BUDDY(node) || PURPLE_BLIST_NODE_IS_CONTACT(node)) {
PurpleBuddy *b = PURPLE_BLIST_NODE_IS_BUDDY(node) ? PURPLE_BUDDY(node) : purple_contact_get_priority_buddy(PURPLE_CONTACT(node));
pidgin_dnd_file_manage(sd, b->account, b->name);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); gtk_drag_finish(dc, FALSE, FALSE, t);
@@ -2937,7 +2951,7 @@
if(gtkblist->tooltipdata == NULL)
- style = gtkblist->tipwindow->style;
+ style = gtk_widget_get_style(gtkblist->tipwindow); @@ -2963,73 +2977,80 @@
for(l = gtkblist->tooltipdata; l; l = l->next)
struct tooltip_data *td = l->data;
+ cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(gtkblist->tipwindow)); if (td->avatar && pidgin_gdk_pixbuf_is_opaque(td->avatar))
if (dir == GTK_TEXT_DIR_RTL)
- gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, gtkblist->tipwindow, "tooltip",
- TOOLTIP_BORDER -1, current_height -1, td->avatar_width +2, td->avatar_height + 2);
+ gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + gtkblist->tipwindow, "tooltip", + TOOLTIP_BORDER - 1, current_height - 1, + td->avatar_width + 2, td->avatar_height + 2); - gtk_paint_flat_box(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- NULL, gtkblist->tipwindow, "tooltip",
- max_width - (td->avatar_width+ TOOLTIP_BORDER)-1,
- current_height-1,td->avatar_width+2, td->avatar_height+2);
+ gtk_paint_flat_box(style, cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + gtkblist->tipwindow, "tooltip", + max_width - (td->avatar_width + TOOLTIP_BORDER) - 1, + td->avatar_width + 2, td->avatar_height + 2); - if (dir == GTK_TEXT_DIR_RTL)
- gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
- 0, 0, max_width - TOOLTIP_BORDER - status_size, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
- gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->status_icon,
- 0, 0, TOOLTIP_BORDER, current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
- if (dir == GTK_TEXT_DIR_RTL)
- gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
- td->avatar, 0, 0, TOOLTIP_BORDER, current_height, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
- gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL,
- td->avatar, 0, 0, max_width - (td->avatar_width + TOOLTIP_BORDER),
- current_height, -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
- if (!td->avatar_is_prpl_icon && td->prpl_icon)
- gdk_draw_pixbuf(GDK_DRAWABLE(gtkblist->tipwindow->window), NULL, td->prpl_icon,
- current_height + ((td->name_height / 2) - (PRPL_SIZE / 2)),
- -1 , -1, GDK_RGB_DITHER_NONE, 0, 0);
+ if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->status_icon, + max_width - TOOLTIP_BORDER - status_size, current_height); + gdk_cairo_set_source_pixbuf(cr, td->status_icon, TOOLTIP_BORDER, current_height); + if (dir == GTK_TEXT_DIR_RTL) { + gdk_cairo_set_source_pixbuf(cr, td->avatar, TOOLTIP_BORDER, + gdk_cairo_set_source_pixbuf(cr, td->avatar, + max_width - (td->avatar_width + TOOLTIP_BORDER), current_height); + if (!td->avatar_is_prpl_icon && td->prpl_icon) { + gdk_cairo_set_source_pixbuf(cr, td->prpl_icon, prpl_col, + current_height + ((td->name_height / 2) - (PRPL_SIZE / 2))); if (dir == GTK_TEXT_DIR_RTL) {
- gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
- NULL, gtkblist->tipwindow, "tooltip",
- max_width -(TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000),
+ gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", + max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000), current_height, td->name_layout);
- gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
- NULL, gtkblist->tipwindow, "tooltip",
+ gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height, td->name_layout);
if (dir != GTK_TEXT_DIR_RTL) {
- gtk_paint_layout (style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
- NULL, gtkblist->tipwindow, "tooltip",
+ gtk_paint_layout (style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", TOOLTIP_BORDER + status_size + SMALL_SPACE, current_height + td->name_height, td->layout);
- gtk_paint_layout(style, gtkblist->tipwindow->window, GTK_STATE_NORMAL, FALSE,
- NULL, gtkblist->tipwindow, "tooltip",
+ gtk_paint_layout(style, cr, GTK_STATE_NORMAL, FALSE, + gtkblist->tipwindow, "tooltip", max_width - (TOOLTIP_BORDER + status_size + SMALL_SPACE) - PANGO_PIXELS(300000),
current_height + td->name_height,
current_height += MAX(td->name_height + td->height, td->avatar_height) + td->padding;
@@ -3180,7 +3201,8 @@
pidgin_blist_expand_contact_cb(NULL, node);
gtk_tree_view_get_cell_area(GTK_TREE_VIEW(tv), path, NULL, >kblist->contact_rect);
- gdk_drawable_get_size(GDK_DRAWABLE(tv->window), &(gtkblist->contact_rect.width), NULL);
+ gtkblist->contact_rect.width = + gdk_window_get_width(gtk_widget_get_window(tv)); gtkblist->mouseover_contact = node;
gtk_tree_path_down (path);
while (gtk_tree_model_get_iter(GTK_TREE_MODEL(gtkblist->treemodel), &i, path)) {
@@ -3577,11 +3599,11 @@
purple_request_fields(gc, _("Edit User Mood"), _("Edit User Mood"),
- _("OK"), G_CALLBACK(edit_mood_cb),
- gc ? purple_connection_get_account(gc) : NULL,
+ _("OK"), G_CALLBACK(edit_mood_cb), + gc ? purple_connection_get_account(gc) : NULL, @@ -3595,6 +3617,123 @@
/***************************************************
***************************************************/
+/* TODO: fill out tooltips... */ +static const GtkActionEntry blist_menu_entries[] = { + { "BuddiesMenu", NULL, N_("_Buddies"), NULL, NULL, NULL }, + { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "<control>M", NULL, pidgin_dialogs_im }, + { "JoinAChat", PIDGIN_STOCK_CHAT, N_("Join a _Chat..."), "<control>C", NULL, pidgin_blist_joinchat_show }, + { "GetUserInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("Get User _Info..."), "<control>I", NULL, pidgin_dialogs_info }, + { "ViewUserLog", NULL, N_("View User _Log..."), "<control>L", NULL, pidgin_dialogs_log }, + { "ShowMenu", NULL, N_("Sh_ow"), NULL, NULL, NULL }, + { "SortMenu", NULL, N_("_Sort Buddies"), NULL, NULL, NULL }, + { "AddBuddy", GTK_STOCK_ADD, N_("_Add Buddy..."), "<control>B", NULL, pidgin_blist_add_buddy_cb }, + { "AddChat", GTK_STOCK_ADD, N_("Add C_hat..."), NULL, NULL, pidgin_blist_add_chat_cb }, + { "AddGroup", GTK_STOCK_ADD, N_("Add _Group..."), NULL, NULL, purple_blist_request_add_group }, + { "Quit", GTK_STOCK_QUIT, N_("_Quit"), "<control>Q", NULL, purple_core_quit }, + { "AccountsMenu", NULL, N_("_Accounts"), NULL, NULL, NULL }, + { "ManageAccounts", NULL, N_("Manage Accounts"), "<control>A", NULL, pidgin_accounts_window_show }, + { "EnableAccountMenu", NULL, N_("Enable Account"), NULL, NULL, NULL }, + { "ToolsMenu", NULL, N_("_Tools"), NULL, NULL, NULL }, + { "BuddyPounces", NULL, N_("Buddy _Pounces"), NULL, NULL, pidgin_pounces_manager_show }, + { "Certificates", NULL, N_("_Certificates"), NULL, NULL, pidgin_certmgr_show }, + { "CustomSmileys", PIDGIN_STOCK_TOOLBAR_SMILEY, N_("Custom Smile_ys"), "<control>Y", NULL, pidgin_smiley_manager_show }, + { "Plugins", PIDGIN_STOCK_TOOLBAR_PLUGINS, N_("Plu_gins"), "<control>U", NULL, pidgin_plugin_dialog_show }, + { "Preferences", GTK_STOCK_PREFERENCES, N_("Pr_eferences"), "<control>P", NULL, pidgin_prefs_show }, + { "Privacy", NULL, N_("Pr_ivacy"), NULL, NULL, pidgin_privacy_dialog_show }, + { "SetMood", NULL, N_("Set _Mood"), "<control>O", NULL, set_mood_show }, + { "FileTransfers", PIDGIN_STOCK_TOOLBAR_TRANSFER, N_("_File Transfers"), "<control>T", NULL, G_CALLBACK(gtk_blist_show_xfer_dialog_cb) }, + { "RoomList", NULL, N_("R_oom List"), NULL, NULL, pidgin_roomlist_dialog_show }, + { "SystemLog", NULL, N_("System _Log"), NULL, NULL, gtk_blist_show_systemlog_cb }, + { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL }, + { "OnlineHelp", GTK_STOCK_HELP, N_("Online _Help"), "F1", NULL, gtk_blist_show_onlinehelp_cb }, + { "BuildInformation", NULL, N_("_Build Information"), NULL, NULL, pidgin_dialogs_buildinfo }, + { "DebugWindow", NULL, N_("_Debug Window"), NULL, NULL, toggle_debug }, + { "DeveloperInformation", NULL, N_("De_veloper Information"), NULL, NULL, pidgin_dialogs_developers }, + { "TranslatorInformation", NULL, N_("_Translator Information"), NULL, NULL, pidgin_dialogs_translators }, + { "About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, pidgin_dialogs_about }, +static const GtkToggleActionEntry blist_menu_toggle_entries[] = { + /* Buddies->Show menu */ + { "ShowOffline", NULL, N_("_Offline Buddies"), NULL, NULL, G_CALLBACK(pidgin_blist_edit_mode_cb), FALSE }, + { "ShowEmptyGroups", NULL, N_("_Empty Groups"), NULL, NULL, G_CALLBACK(pidgin_blist_show_empty_groups_cb), FALSE }, + { "ShowBuddyDetails", NULL, N_("Buddy _Details"), NULL, NULL, G_CALLBACK(pidgin_blist_buddy_details_cb), FALSE }, + { "ShowIdleTimes", NULL, N_("Idle _Times"), NULL, NULL, G_CALLBACK(pidgin_blist_show_idle_time_cb), FALSE }, + { "ShowProtocolIcons", NULL, N_("_Protocol Icons"), NULL, NULL, G_CALLBACK(pidgin_blist_show_protocol_icons_cb), FALSE }, + { "MuteSounds", NULL, N_("Mute _Sounds"), NULL, NULL, G_CALLBACK(pidgin_blist_mute_sounds_cb), FALSE }, +static const char *blist_menu = + "<menubar name='BList'>" + "<menu action='BuddiesMenu'>" + "<menuitem action='NewInstantMessage'/>" + "<menuitem action='JoinAChat'/>" + "<menuitem action='GetUserInfo'/>" + "<menuitem action='ViewUserLog'/>" + "<menu action='ShowMenu'>" + "<menuitem action='ShowOffline'/>" + "<menuitem action='ShowEmptyGroups'/>" + "<menuitem action='ShowBuddyDetails'/>" + "<menuitem action='ShowIdleTimes'/>" + "<menuitem action='ShowProtocolIcons'/>" + "<menu action='SortMenu'/>" + "<menuitem action='AddBuddy'/>" + "<menuitem action='AddChat'/>" + "<menuitem action='AddGroup'/>" + "<menuitem action='Quit'/>" + "<menu action='AccountsMenu'>" + "<menuitem action='ManageAccounts'/>" + "<menu action='EnableAccountMenu'/>" + "<placeholder name='Accounts'/>" + "<menu action='ToolsMenu'>" + "<menuitem action='BuddyPounces'/>" + "<menuitem action='Certificates'/>" + "<menuitem action='CustomSmileys'/>" + "<menuitem action='Plugins'/>" + "<menuitem action='Preferences'/>" + "<menuitem action='Privacy'/>" + "<menuitem action='SetMood'/>" + "<menuitem action='FileTransfers'/>" + "<menuitem action='RoomList'/>" + "<menuitem action='SystemLog'/>" + "<menuitem action='MuteSounds'/>" + "<placeholder name='PluginActions'/>" + "<menu action='HelpMenu'>" + "<menuitem action='OnlineHelp'/>" + "<menuitem action='BuildInformation'/>" + "<menuitem action='DebugWindow'/>" + "<menuitem action='DeveloperInformation'/>" + "<menuitem action='TranslatorInformation'/>" + "<menuitem action='About'/>" static GtkItemFactoryEntry blist_menu[] =
/* NOTE: Do not set any accelerator to Control+O. It is mapped by
@@ -3652,6 +3791,7 @@
{ "/Help/sep2", NULL, NULL, 0, "<Separator>", NULL },
{ N_("/Help/_About"), NULL, pidgin_dialogs_about, 4, "<StockItem>", GTK_STOCK_ABOUT },
/*********************************************************
* Private Utility functions *
@@ -4386,7 +4526,7 @@
/* if the window exists, is hidden, we're saving positions, and the
if (gtkblist && gtkblist->window &&
- !GTK_WIDGET_VISIBLE(gtkblist->window) && blist_width != 0) {
+ !gtk_widget_get_visible(gtkblist->window) && blist_width != 0) { blist_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/x");
blist_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/y");
@@ -4416,7 +4556,7 @@
PurpleBlistNode *gnode, *cnode;
if (gtk_blist_visibility == GDK_VISIBILITY_FULLY_OBSCURED
- || !GTK_WIDGET_VISIBLE(gtkblist->window))
+ || !gtk_widget_get_visible(gtkblist->window)) for(gnode = list->root; gnode; gnode = gnode->next) {
@@ -4462,12 +4602,21 @@
static const char *require_connection[] =
+ "/BList/BuddiesMenu/NewInstantMessage", + "/BList/BuddiesMenu/JoinAChat", + "/BList/BuddiesMenu/GetUserInfo", + "/BList/BuddiesMenu/AddBuddy", + "/BList/BuddiesMenu/AddChat", + "/BList/BuddiesMenu/AddGroup", N_("/Buddies/New Instant Message..."),
N_("/Buddies/Join a Chat..."),
N_("/Buddies/Get User Info..."),
N_("/Buddies/Add Buddy..."),
N_("/Buddies/Add Chat..."),
N_("/Buddies/Add Group..."),
static const int require_connection_size = sizeof(require_connection)
@@ -4480,7 +4629,7 @@
update_menu_bar(PidginBuddyList *gtkblist)
@@ -4492,21 +4641,21 @@
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());
+ action = gtk_ui_manager_get_action(gtkblist->ui, require_connection[i]); + gtk_action_set_sensitive(action, sensitive); + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/JoinAChat"); + gtk_action_set_sensitive(action, pidgin_blist_joinchat_is_showable()); + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/AddChat"); + gtk_action_set_sensitive(action, pidgin_blist_joinchat_is_showable()); + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/Privacy"); + gtk_action_set_sensitive(action, sensitive); + action = gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/RoomList"); + gtk_action_set_sensitive(action, pidgin_roomlist_is_showable()); @@ -4797,12 +4946,6 @@
-item_factory_translate_func (const char *path, gpointer func_data)
- return _((char *)path);
void pidgin_blist_setup_sort_methods()
@@ -4925,7 +5068,7 @@
widget = gtk_window_get_focus(GTK_WINDOW(gtkblist->window));
if (GTK_IS_IMHTML(widget) || GTK_IS_ENTRY(widget)) {
- if (gtk_bindings_activate(GTK_OBJECT(widget), event->keyval, event->state))
+ if (gtk_bindings_activate(G_OBJECT(widget), event->keyval, event->state)) @@ -4934,14 +5077,14 @@
headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist)
- gdk_window_set_cursor(widget->window, gtkblist->hand_cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->hand_cursor); headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginBuddyList *gtkblist)
- gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), gtkblist->arrow_cursor); @@ -5075,7 +5218,7 @@
-generic_error_destroy_cb(GtkObject *dialog,
+generic_error_destroy_cb(GtkWidget *dialog, g_hash_table_remove(gtkblist->connection_errors, account);
@@ -5447,17 +5590,22 @@
- gtk_paint_flat_box (widget->style,
- widget->allocation.x + 1,
- widget->allocation.y + 1,
- widget->allocation.width - 2,
- widget->allocation.height - 2);
+ cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget)); + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + gtk_paint_flat_box (gtk_widget_get_style(widget), + allocation.height - 2); @@ -5481,8 +5629,28 @@
headline_style_set (GtkWidget *widget,
+#if GTK_CHECK_VERSION(2,12,0) + if (gtkblist->changing_style) + /* 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);
if (gtkblist->changing_style)
@@ -5502,6 +5670,7 @@
gtkblist->changing_style = FALSE;
g_object_unref (tooltips);
/******************************************/
@@ -5738,6 +5907,8 @@
+ GtkActionGroup *action_group; GtkAccelGroup *accel_group;
GtkTreeSelection *selection;
GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
@@ -5773,7 +5944,9 @@
G_CALLBACK(blist_focus_cb), gtkblist);
g_signal_connect(G_OBJECT(gtkblist->window), "focus-out-event",
G_CALLBACK(blist_focus_cb), gtkblist);
- GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;
+ /* TODO: how is this done in gtk+ 3.0? */ + /*GTK_WINDOW(gtkblist->window)->allow_shrink = TRUE;*/ gtkblist->main_vbox = gtk_vbox_new(FALSE, 0);
gtk_widget_show(gtkblist->main_vbox);
@@ -5787,28 +5960,41 @@
gtk_widget_add_events(gtkblist->window, GDK_VISIBILITY_NOTIFY_MASK);
/******************************* Menu bar *************************************/
- 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,
- gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu),
- 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>");
+ action_group = gtk_action_group_new("BListActions"); + gtk_action_group_add_actions(action_group, + G_N_ELEMENTS(blist_menu_entries), + GTK_WINDOW(gtkblist->window)); + gtk_action_group_add_toggle_actions(action_group, + blist_menu_toggle_entries, + G_N_ELEMENTS(blist_menu_toggle_entries), + GTK_WINDOW(gtkblist->window)); + gtk_action_group_set_translation_domain(action_group, + gtkblist->ui = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group(gtkblist->ui, action_group, 0); + accel_group = gtk_ui_manager_get_accel_group(gtkblist->ui); + gtk_window_add_accel_group(GTK_WINDOW(gtkblist->window), accel_group); + if (!gtk_ui_manager_add_ui_from_string(gtkblist->ui, blist_menu, -1, &error)) + g_message("building menus failed: %s", error->message); + menu = gtk_ui_manager_get_widget(gtkblist->ui, "/BList"); gtkblist->menutray = pidgin_menu_tray_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
gtk_widget_show(gtkblist->menutray);
gtk_box_pack_start(GTK_BOX(gtkblist->main_vbox), menu, FALSE, FALSE, 0);
- accountmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Accounts"));
/****************************** Notebook *************************************/
gtkblist->notebook = gtk_notebook_new();
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkblist->notebook), FALSE);
@@ -5829,7 +6015,6 @@
pretty = pidgin_make_pretty_arrows(tmp);
label = gtk_label_new(NULL);
- gtk_widget_set_size_request(label, purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width") - 12, -1);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.2);
gtk_label_set_markup(GTK_LABEL(label), pretty);
@@ -5846,10 +6031,8 @@
gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline_hbox), 6);
gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox);
gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL);
- gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.0, 0);
+ gtk_misc_set_alignment(GTK_MISC(gtkblist->headline_image), 0.5, 0.5); gtkblist->headline_label = gtk_label_new(NULL);
- gtk_widget_set_size_request(gtkblist->headline_label,
- purple_prefs_get_int(PIDGIN_PREFS_ROOT "/blist/width")-25,-1);
gtk_label_set_line_wrap(GTK_LABEL(gtkblist->headline_label), TRUE);
gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0);
@@ -5859,7 +6042,7 @@
G_CALLBACK(headline_style_set),
g_signal_connect (gtkblist->headline_hbox,
G_CALLBACK (paint_headline_hbox),
gtk_widget_set_name(gtkblist->headline_hbox, "gtk-tooltips");
@@ -5995,26 +6178,26 @@
/* set the Show Offline Buddies option. must be done
* after the treeview or faceprint gets mad. -Robot101
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Offline Buddies"))),
+ 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"));
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item (gtkblist->ift, N_("/Buddies/Show/Empty Groups"))),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowEmptyGroups")), 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"))),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds")), 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"))),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowBuddyDetails")), 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"))),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowIdleTimes")), 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"))),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(gtkblist->ui, "/BList/BuddiesMenu/ShowMenu/ShowProtocolIcons")), 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);
+ gtk_action_set_sensitive(gtk_ui_manager_get_action(gtkblist->ui, "/BList/ToolsMenu/MuteSounds"), FALSE); /* Update some dynamic things */
update_menu_bar(gtkblist);
@@ -6871,7 +7054,7 @@
purple_signals_disconnect_by_handle(gtkblist);
if (gtkblist->headline_close)
- gdk_pixbuf_unref(gtkblist->headline_close);
+ g_object_unref(G_OBJECT(gtkblist->headline_close)); gtk_widget_destroy(gtkblist->window);
@@ -6891,7 +7074,7 @@
gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL;
g_object_unref(G_OBJECT(gtkblist->treemodel));
gtkblist->treemodel = NULL;
- g_object_unref(G_OBJECT(gtkblist->ift));
+ g_object_unref(G_OBJECT(gtkblist->ui)); g_object_unref(G_OBJECT(gtkblist->empty_avatar));
gdk_cursor_unref(gtkblist->hand_cursor);
@@ -6905,7 +7088,6 @@
purple_prefs_disconnect_by_handle(pidgin_blist_get_handle());
@@ -6916,7 +7098,8 @@
- if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && !GTK_WIDGET_VISIBLE(gtkblist->window))
+ if(!PIDGIN_WINDOW_ICONIFIED(gtkblist->window) && + !gtk_widget_get_visible(gtkblist->window)) purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-unhiding", gtkblist);
pidgin_blist_restore_position();
gtk_window_present(GTK_WINDOW(gtkblist->window));
@@ -6925,7 +7108,7 @@
purple_signal_emit(pidgin_blist_get_handle(), "gtkblist-hiding", gtkblist);
gtk_widget_hide(gtkblist->window);
- if (!GTK_WIDGET_VISIBLE(gtkblist->window))
+ if (!gtk_widget_get_visible(gtkblist->window)) gtk_widget_show(gtkblist->window);
gtk_window_iconify(GTK_WINDOW(gtkblist->window));
@@ -7330,7 +7513,7 @@
pidgin_blist_toggle_visibility()
if (gtkblist && gtkblist->window) {
- if (GTK_WIDGET_VISIBLE(gtkblist->window)) {
+ if (gtk_widget_get_visible(gtkblist->window)) { /* make the buddy list visible if it is iconified or if it is
* obscured and not currently focused (the focus part ensures
* that we do something reasonable if the buddy list is obscured
@@ -7395,7 +7578,7 @@
- if (gtkblist->window && !GTK_WIDGET_HAS_FOCUS(gtkblist->window))
+ if (gtkblist->window && !gtk_widget_is_focus(gtkblist->window)) pidgin_set_urgent(GTK_WINDOW(gtkblist->window), TRUE);
@@ -7887,7 +8070,7 @@
if(PURPLE_BLIST_NODE_IS_CONTACT(n)) {
for (n2 = n->child; n2; n2 = n2->next) {
- buddy = (PurpleBuddy*)n2;
+ buddy = (PurpleBuddy*)n2; this_log_activity_score += purple_log_get_activity_score(PURPLE_LOG_IM, buddy->name, buddy->account);
this_buddy_name = purple_contact_get_alias((PurpleContact*)n);
@@ -7923,47 +8106,50 @@
-plugin_act(GtkObject *obj, PurplePluginAction *pam)
+plugin_act(GtkWidget *obj, PurplePluginAction *pam) if (pam && pam->callback)
-build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin,
+build_plugin_actions(GtkActionGroup *action_group, GString *ui, char *parent, + PurplePlugin *plugin, gpointer context) PurplePluginAction *action = NULL;
actions = PURPLE_PLUGIN_ACTIONS(plugin, context);
- for (l = actions; l != NULL; l = l->next)
- action = (PurplePluginAction *) l->data;
+ for (l = actions; l != NULL; l = l->next) { + action = (PurplePluginAction *)l->data; 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",
+ name = g_strdup_printf("%s-action-%d", parent, count++); + menuaction = gtk_action_new(name, action->label, NULL, NULL); + gtk_action_group_add_action(action_group, menuaction); + g_string_append_printf(ui, "<menuitem action='%s'/>", name); + g_signal_connect(G_OBJECT(menuaction), "activate", G_CALLBACK(plugin_act), action);
- g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
+ g_object_set_data_full(G_OBJECT(menuaction), "plugin_action", (GDestroyNotify)purple_plugin_action_free);
- gtk_widget_show(menuitem);
- pidgin_separator(menu);
+ g_string_append(ui, "<separator/>"); modify_account_cb(GtkWidget *widget, gpointer data)
@@ -7995,183 +8181,146 @@
pidgin_blist_update_accounts_menu(void)
- GtkWidget *menuitem = NULL, *submenu = NULL;
- GtkAccelGroup *accel_group = NULL;
- GList *l = NULL, *accounts = NULL;
- gboolean disabled_accounts = FALSE;
- gboolean enabled_accounts = FALSE;
- if (accountmenu == NULL)
+ GList *accounts = NULL; + if ((gtkblist == NULL) || (gtkblist->ui == NULL)) - /* Clear the old Accounts menu */
- for (l = gtk_container_get_children(GTK_CONTAINER(accountmenu)); l; l = g_list_delete_link(l, l)) {
- 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) {
- 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);
- pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
- 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);
- enabled_accounts = TRUE;
- if (!enabled_accounts) {
- gtk_widget_show_all(accountmenu);
- pidgin_separator(accountmenu);
- accel_group = gtk_menu_get_accel_group(GTK_MENU(accountmenu));
+ /* Clear the old menu */ + if (accounts_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, accounts_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, accounts_action_group); + g_object_unref(G_OBJECT(accounts_action_group)); + accounts_action_group = gtk_action_group_new("Accounts"); + gtk_action_group_set_translation_domain(accounts_action_group, PACKAGE); + accounts_ui = g_string_new(NULL); + enable_ui = g_string_new(NULL); + action = gtk_action_new("none-available", N_("No actions available"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + gtk_action_set_sensitive(action, FALSE); for (accounts = purple_accounts_get_all(); accounts; accounts = accounts->next) {
- 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))
- buf = g_strconcat(purple_account_get_username(account), " (",
+ base = name = g_strdup_printf("account%d", count); + label = 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);
- pixbuf = pidgin_create_prpl_icon(account, PIDGIN_PRPL_ICON_SMALL);
- if (!purple_account_is_connected(account))
- gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf,
- 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;
- (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);
+ action = gtk_action_new(name, label, NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + if (!purple_account_get_enabled(account, PIDGIN_UI)) { + g_string_append_printf(enable_ui, "<menuitem action='%s'/>", name); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(enable_account_cb), account); + PurpleConnection *gc = NULL; + PurplePlugin *plugin = NULL; + g_string_append_printf(accounts_ui, "<menu action='%s'>", name); + name = g_strconcat(base, "-edit", NULL); + action = gtk_action_new(name, N_("_Edit Account"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(modify_account_cb), account); + g_string_append_printf(accounts_ui, "<menuitem action='%s'/>", name); + g_string_append(accounts_ui, "<separator/>"); + gc = purple_account_get_connection(account); + plugin = gc && PURPLE_CONNECTION_IS_CONNECTED(gc) ? gc->prpl : NULL; + if (plugin && PURPLE_PLUGIN_HAS_ACTIONS(plugin)) { + build_plugin_actions(accounts_action_group, accounts_ui, base, plugin, gc); + g_string_append(accounts_ui, "<menuitem action='none-available'/>"); - if (PURPLE_PLUGIN_HAS_ACTIONS(plugin)) {
- build_plugin_actions(submenu, plugin, gc);
- 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);
-static GList *plugin_submenus = NULL;
+ g_string_append(accounts_ui, "<separator/>"); + name = g_strconcat(base, "-disable", NULL); + action = gtk_action_new(name, N_("_Disable"), NULL, NULL); + gtk_action_group_add_action(accounts_action_group, action); + g_signal_connect(G_OBJECT(action), "activate", + G_CALLBACK(disable_account_cb), account); + g_string_append_printf(accounts_ui, "<menuitem action='%s'/>", name); + g_string_append(accounts_ui, "</menu>"); + ui_string = g_strconcat("<ui><menubar action='BList'><menu action='AccountsMenu'><menu action='EnableAccountMenu'>", + "</menu><placeholder name='Accounts'>", + "</placeholder></menu></menubar></ui>", + gtk_ui_manager_insert_action_group(gtkblist->ui, accounts_action_group, 1); + accounts_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); +purple_debug_info("blist", "The account menu is {%s}\n", ui_string); + g_string_free(enable_ui, TRUE); + g_string_free(accounts_ui, TRUE); +static guint plugins_merge_id; +static GtkActionGroup *plugins_action_group = NULL; pidgin_blist_update_plugin_actions(void)
- GtkWidget *menuitem, *submenu;
PurplePlugin *plugin = NULL;
- 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));
+ if ((gtkblist == NULL) || (gtkblist->ui == NULL)) + /* Clear the old menu */ + if (plugins_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, plugins_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, plugins_action_group); + g_object_unref(G_OBJECT(plugins_action_group)); + plugins_action_group = gtk_action_group_new("PluginActions"); + gtk_action_group_set_translation_domain(plugins_action_group, PACKAGE); + plugins_ui = g_string_new(NULL); /* Add a submenu for each plugin with custom actions */
for (l = purple_plugins_get_loaded(); l; l = l->next) {
- plugin = (PurplePlugin *) l->data;
+ plugin = (PurplePlugin *)l->data; if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
@@ -8179,28 +8328,35 @@
if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
- 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);
- build_plugin_actions(submenu, plugin, NULL);
- gtk_widget_show_all(pluginmenu);
+ name = g_strdup_printf("plugin%d", count); + action = gtk_action_new(name, plugin->info->name, NULL, NULL); + gtk_action_group_add_action(plugins_action_group, action); + g_string_append_printf(plugins_ui, "<menu action='%s'>", name); + build_plugin_actions(plugins_action_group, plugins_ui, name, plugin, NULL); + g_string_append(plugins_ui, "</menu>"); + ui_string = g_strconcat("<ui><menubar action='BList'><menu action='ToolsMenu'><placeholder name='PluginActions'>", + "</placeholder></menu></menubar></ui>", + gtk_ui_manager_insert_action_group(gtkblist->ui, plugins_action_group, 1); + plugins_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string, -1, NULL); +purple_debug_info("blist", "The plugins menu is {%s}\n", ui_string); + g_string_free(plugins_ui, TRUE); -sortmethod_act(GtkCheckMenuItem *checkmenuitem, char *id)
- if (gtk_check_menu_item_get_active(checkmenuitem))
+sortmethod_act(GtkRadioAction *action, GtkRadioAction *current, char *id) pidgin_set_cursor(gtkblist->window, GDK_WATCH);
/* This is redundant. I think. */
@@ -8214,40 +8370,57 @@
pidgin_blist_update_sort_methods(void)
- GtkWidget *menuitem = NULL, *activeitem = NULL;
PidginBlistSortMethod *method = NULL;
const char *m = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/sort_type");
- if ((gtkblist == NULL) || (gtkblist->ift == NULL))
- g_return_if_fail(m != NULL);
- sortmenu = gtk_item_factory_get_widget(gtkblist->ift, N_("/Buddies/Sort Buddies"));
+ GtkRadioAction *action; + if ((gtkblist == NULL) || (gtkblist->ui == NULL)) - for (l = gtk_container_get_children(GTK_CONTAINER(sortmenu)); l; l = g_list_delete_link(l, l)) {
- gtk_widget_destroy(GTK_WIDGET(menuitem));
+ if (sort_action_group) { + gtk_ui_manager_remove_ui(gtkblist->ui, sort_merge_id); + gtk_ui_manager_remove_action_group(gtkblist->ui, sort_action_group); + g_object_unref(G_OBJECT(sort_action_group)); + sort_action_group = gtk_action_group_new("SortMethods"); + gtk_action_group_set_translation_domain(sort_action_group, PACKAGE); + ui_string = g_string_new("<ui><menubar name='BList'>" + "<menu action='BuddiesMenu'><menu action='SortMenu'>"); 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))
- 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);
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(activeitem), TRUE);
+ method = (PidginBlistSortMethod *)l->data; + g_string_append_printf(ui_string, "<menuitem action='%s'/>", method->id); + action = gtk_radio_action_new(method->id, + gtk_action_group_add_action_with_accel(sort_action_group, GTK_ACTION(action), NULL); + gtk_radio_action_set_group(action, sl); + sl = gtk_radio_action_get_group(action); + if (!strcmp(m, method->id)) + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), TRUE); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), FALSE); + g_signal_connect(G_OBJECT(action), "changed", + G_CALLBACK(sortmethod_act), method->id); + g_string_append(ui_string, "</menu></menu></menubar></ui>"); + gtk_ui_manager_insert_action_group(gtkblist->ui, sort_action_group, 1); + sort_merge_id = gtk_ui_manager_add_ui_from_string(gtkblist->ui, ui_string->str, -1, NULL); + g_string_free(ui_string, TRUE); --- a/pidgin/gtkconv.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkconv.c Mon Aug 22 22:39:32 2011 +0000
@@ -158,7 +158,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);
-static const char *item_factory_translate_func (const char *path, gpointer func_data);
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);
@@ -775,15 +774,17 @@
InviteBuddyInfo *info = (InviteBuddyInfo *)data;
const char *convprotocol;
+ GdkAtom target = gtk_selection_data_get_target(sd); convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv));
- if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
+ if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) PurpleBlistNode *node = NULL;
- memcpy(&node, sd->data, sizeof(node));
+ const guchar *data = gtk_selection_data_get_data(sd); + memcpy(&node, data, sizeof(node)); if (PURPLE_BLIST_NODE_IS_CONTACT(node))
buddy = purple_contact_get_priority_buddy((PurpleContact *)node);
@@ -802,15 +803,16 @@
gtk_entry_set_text(GTK_ENTRY(info->entry), purple_buddy_get_name(buddy));
- gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
- else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
+ gtk_drag_finish(dc, success, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) - if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
+ if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, NULL))
@@ -835,7 +837,8 @@
- gtk_drag_finish(dc, success, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, success, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); @@ -877,12 +880,15 @@
gtk_container_set_border_width(GTK_CONTAINER(invite_dialog), PIDGIN_HIG_BOX_SPACE);
gtk_window_set_resizable(GTK_WINDOW(invite_dialog), FALSE);
+ /* TODO: set no separator using GTK+ 3.0 */ gtk_dialog_set_has_separator(GTK_DIALOG(invite_dialog), FALSE);
info->window = GTK_WIDGET(invite_dialog);
/* Setup the outside spacing. */
- vbox = GTK_DIALOG(invite_dialog)->vbox;
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(invite_dialog)); gtk_box_set_spacing(GTK_BOX(vbox), PIDGIN_HIG_BORDER);
gtk_container_set_border_width(GTK_CONTAINER(vbox), PIDGIN_HIG_BOX_SPACE);
@@ -974,7 +980,7 @@
-menu_new_conv_cb(gpointer data, guint action, GtkWidget *widget)
+menu_new_conv_cb(GtkAction *action, gpointer data) @@ -1021,7 +1027,7 @@
* plaintext v. HTML file.
-menu_save_as_cb(gpointer data, guint action, GtkWidget *widget)
+menu_save_as_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
@@ -1051,7 +1057,7 @@
-menu_view_log_cb(gpointer data, guint action, GtkWidget *widget)
+menu_view_log_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1075,10 +1081,12 @@
gtkblist = pidgin_blist_get_default_gtk_blist();
cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(gtkblist->window->window, cursor);
- gdk_window_set_cursor(win->window->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), cursor); + gdk_window_set_cursor(gtk_widget_get_window(win->window), cursor); gdk_cursor_unref(cursor);
+#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,6,0) //FIXME: What? gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window)));
name = purple_conversation_get_name(conv);
account = purple_conversation_get_account(conv);
@@ -1091,8 +1099,8 @@
pidgin_log_show_contact((PurpleContact *)node->parent);
- gdk_window_set_cursor(gtkblist->window->window, NULL);
- gdk_window_set_cursor(win->window->window, NULL);
+ gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); + gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); @@ -1100,12 +1108,12 @@
pidgin_log_show(type, name, account);
- gdk_window_set_cursor(gtkblist->window->window, NULL);
- gdk_window_set_cursor(win->window->window, NULL);
-menu_clear_cb(gpointer data, guint action, GtkWidget *widget)
+ gdk_window_set_cursor(gtk_widget_get_window(gtkblist->window), NULL); + gdk_window_set_cursor(gtk_widget_get_window(win->window), NULL); +menu_clear_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1115,7 +1123,7 @@
-menu_find_cb(gpointer data, guint action, GtkWidget *widget)
+menu_find_cb(GtkAction *action, gpointer data) PidginWindow *gtkwin = data;
PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(gtkwin);
@@ -1125,7 +1133,7 @@
-menu_initiate_media_call_cb(gpointer data, guint action, GtkWidget *widget)
+menu_initiate_media_call_cb(GtkAction *action, gpointer data) PidginWindow *win = (PidginWindow *)data;
PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
@@ -1133,15 +1141,15 @@
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 |
+ action == win->audio_call ? PURPLE_MEDIA_AUDIO : + action == win->video_call ? PURPLE_MEDIA_VIDEO : + action == win->audio_video_call ? PURPLE_MEDIA_AUDIO | PURPLE_MEDIA_VIDEO : PURPLE_MEDIA_NONE);
-menu_send_file_cb(gpointer data, guint action, GtkWidget *widget)
+menu_send_file_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
@@ -1153,7 +1161,7 @@
-menu_get_attention_cb(gpointer data, guint action, GtkWidget *widget)
+menu_get_attention_cb(GtkAction *ation, gpointer data) PidginWindow *win = data;
PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
@@ -1165,7 +1173,7 @@
-menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget)
+menu_add_pounce_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1177,7 +1185,7 @@
-menu_insert_link_cb(gpointer data, guint action, GtkWidget *widget)
+menu_insert_link_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PidginConversation *gtkconv;
@@ -1191,7 +1199,7 @@
-menu_insert_image_cb(gpointer data, guint action, GtkWidget *widget)
+menu_insert_image_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PidginConversation *gtkconv;
@@ -1206,7 +1214,7 @@
-menu_alias_cb(gpointer data, guint action, GtkWidget *widget)
+menu_alias_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1233,7 +1241,7 @@
-menu_get_info_cb(gpointer data, guint action, GtkWidget *widget)
+menu_get_info_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1244,7 +1252,7 @@
-menu_invite_cb(gpointer data, guint action, GtkWidget *widget)
+menu_invite_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1255,7 +1263,7 @@
-menu_block_cb(gpointer data, guint action, GtkWidget *widget)
+menu_block_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1266,7 +1274,7 @@
-menu_unblock_cb(gpointer data, guint action, GtkWidget *widget)
+menu_unblock_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1277,7 +1285,7 @@
-menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget)
+menu_add_remove_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1322,7 +1330,7 @@
-menu_close_conv_cb(gpointer data, guint action, GtkWidget *widget)
+menu_close_conv_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
@@ -1330,7 +1338,7 @@
-menu_logging_cb(gpointer data, guint action, GtkWidget *widget)
+menu_logging_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1342,7 +1350,7 @@
- logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+ logging = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); if (logging == purple_conversation_is_logging(conv))
@@ -1395,14 +1403,14 @@
-menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget)
+menu_toolbar_cb(GtkAction *action, gpointer data) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar",
- gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
-menu_sounds_cb(gpointer data, guint action, GtkWidget *widget)
+ gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); +menu_sounds_cb(GtkAction *action, gpointer data) PidginWindow *win = data;
PurpleConversation *conv;
@@ -1417,17 +1425,17 @@
gtkconv = PIDGIN_CONVERSATION(conv);
- gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+ gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action)); node = get_conversation_blist_node(conv);
purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound);
-menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget)
+menu_timestamps_cb(GtkAction *action, gpointer data) purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps",
- gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
+ gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(action))); @@ -1924,8 +1932,8 @@
/* If CTRL was held down... */
if (event->state & GDK_CONTROL_MASK) {
+ case GDK_KEY_Page_Down: + case GDK_KEY_KP_Page_Down: if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv + 1))
gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0);
@@ -1934,8 +1942,8 @@
+ case GDK_KEY_KP_Page_Up: if (!pidgin_conv_window_get_gtkconv_at_index(win, curconv - 1))
gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), -1);
@@ -1944,9 +1952,9 @@
+ case GDK_KEY_ISO_Left_Tab: if (event->state & GDK_SHIFT_MASK) {
move_to_next_unread_tab(gtkconv, FALSE);
@@ -1956,20 +1964,20 @@
gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
gtk_notebook_reorder_child(GTK_NOTEBOOK(win->notebook),
gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), curconv),
(curconv + 1) % gtk_notebook_get_n_pages(GTK_NOTEBOOK(win->notebook)));
if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD))
@@ -1993,13 +2001,13 @@
if (gtk_widget_is_focus(GTK_WIDGET(win->notebook))) {
infopane_entry_activate(gtkconv);
if (gtkconv_cycle_focus(gtkconv, event->state & GDK_SHIFT_MASK ? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD))
@@ -2023,7 +2031,7 @@
/* If CTRL was held down... */
if (event->state & GDK_CONTROL_MASK) {
if (!gtkconv->send_history)
@@ -2074,7 +2082,7 @@
if (!gtkconv->send_history)
@@ -2127,9 +2135,9 @@
/* If neither CTRL nor ALT were held down... */
+ case GDK_KEY_ISO_Left_Tab: if (gtkconv->entry != entry)
@@ -2141,14 +2149,14 @@
+ case GDK_KEY_KP_Page_Up: gtk_imhtml_page_up(GTK_IMHTML(gtkconv->imhtml));
+ case GDK_KEY_Page_Down: + case GDK_KEY_KP_Page_Down: gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml));
@@ -2192,26 +2200,26 @@
/* If we have a valid key for the conversation display, then exit */
if ((event->state & GDK_CONTROL_MASK) ||
- (event->keyval == GDK_F6) ||
- (event->keyval == GDK_F10) ||
- (event->keyval == GDK_Shift_L) ||
- (event->keyval == GDK_Shift_R) ||
- (event->keyval == GDK_Control_L) ||
- (event->keyval == GDK_Control_R) ||
- (event->keyval == GDK_Escape) ||
- (event->keyval == GDK_Up) ||
- (event->keyval == GDK_Down) ||
- (event->keyval == GDK_Left) ||
- (event->keyval == GDK_Right) ||
- (event->keyval == GDK_Page_Up) ||
- (event->keyval == GDK_KP_Page_Up) ||
- (event->keyval == GDK_Page_Down) ||
- (event->keyval == GDK_KP_Page_Down) ||
- (event->keyval == GDK_Home) ||
- (event->keyval == GDK_End) ||
- (event->keyval == GDK_Tab) ||
- (event->keyval == GDK_KP_Tab) ||
- (event->keyval == GDK_ISO_Left_Tab))
+ (event->keyval == GDK_KEY_F6) || + (event->keyval == GDK_KEY_F10) || + (event->keyval == GDK_KEY_Shift_L) || + (event->keyval == GDK_KEY_Shift_R) || + (event->keyval == GDK_KEY_Control_L) || + (event->keyval == GDK_KEY_Control_R) || + (event->keyval == GDK_KEY_Escape) || + (event->keyval == GDK_KEY_Up) || + (event->keyval == GDK_KEY_Down) || + (event->keyval == GDK_KEY_Left) || + (event->keyval == GDK_KEY_Right) || + (event->keyval == GDK_KEY_Page_Up) || + (event->keyval == GDK_KEY_KP_Page_Up) || + (event->keyval == GDK_KEY_Page_Down) || + (event->keyval == GDK_KEY_KP_Page_Down) || + (event->keyval == GDK_KEY_Home) || + (event->keyval == GDK_KEY_End) || + (event->keyval == GDK_KEY_Tab) || + (event->keyval == GDK_KEY_KP_Tab) || + (event->keyval == GDK_KEY_ISO_Left_Tab)) if (event->type == GDK_KEY_PRESS)
return conv_keypress_common(gtkconv, event);
@@ -2254,7 +2262,7 @@
gtkconv->active_conv = conv;
purple_conversation_set_logging(conv,
- gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
+ gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging))); entry = GTK_IMHTML(gtkconv->entry);
protocol_name = purple_account_get_protocol_name(conv->account);
@@ -2442,8 +2450,7 @@
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
PurpleBuddy *b = purple_find_buddy(account, name);
- p = purple_buddy_get_presence(b);
+ PurplePresence *p = purple_buddy_get_presence(b); if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY))
if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE))
@@ -2679,7 +2686,7 @@
-start_anim(GtkObject *obj, PidginConversation *gtkconv)
+start_anim(GtkWidget *widget, PidginConversation *gtkconv) @@ -2852,7 +2859,7 @@
-stop_anim(GtkObject *obj, PidginConversation *gtkconv)
+stop_anim(GtkWidget *widget, PidginConversation *gtkconv) if (gtkconv->u.im->icon_timer != 0)
g_source_remove(gtkconv->u.im->icon_timer);
@@ -2874,7 +2881,7 @@
-icon_menu(GtkObject *obj, GdkEventButton *e, PidginConversation *gtkconv)
+icon_menu(GtkWidget *widget, GdkEventButton *e, PidginConversation *gtkconv) static GtkWidget *menu = NULL;
PurpleConversation *conv;
@@ -3068,6 +3075,101 @@
+static GtkActionEntry menu_entries[] = +/* TODO: fill out tooltips... */ + /* Conversation menu */ + { "ConversationMenu", NULL, N_("_Conversation"), NULL, NULL, NULL }, + { "NewInstantMessage", PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, N_("New Instant _Message..."), "<control>M", NULL, G_CALLBACK(menu_new_conv_cb) }, + { "Find", GTK_STOCK_FIND, N_("_Find..."), NULL, NULL, G_CALLBACK(menu_find_cb) }, + { "ViewLog", NULL, N_("View _Log"), NULL, NULL, G_CALLBACK(menu_view_log_cb) }, + { "SaveAs", GTK_STOCK_SAVE_AS, N_("_Save As..."), NULL, NULL, G_CALLBACK(menu_save_as_cb) }, + { "ClearScrollback", GTK_STOCK_CLEAR, N_("Clea_r Scrollback"), "<control>L", NULL, G_CALLBACK(menu_clear_cb) }, + { "MediaMenu", NULL, N_("M_edia"), NULL, NULL, NULL }, + { "AudioCall", PIDGIN_STOCK_TOOLBAR_AUDIO_CALL, N_("_Audio Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "VideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("_Video Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "AudioVideoCall", PIDGIN_STOCK_TOOLBAR_VIDEO_CALL, N_("Audio/Video _Call"), NULL, NULL, G_CALLBACK(menu_initiate_media_call_cb) }, + { "SendFile", PIDGIN_STOCK_TOOLBAR_SEND_FILE, N_("Se_nd File..."), NULL, NULL, G_CALLBACK(menu_send_file_cb) }, + { "GetAttention", PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, N_("Get _Attention"), NULL, NULL, G_CALLBACK(menu_get_attention_cb) }, + { "AddBuddyPounce", NULL, N_("Add Buddy _Pounce..."), NULL, NULL, G_CALLBACK(menu_add_pounce_cb) }, + { "GetInfo", PIDGIN_STOCK_TOOLBAR_USER_INFO, N_("_Get Info"), "<control>O", NULL, G_CALLBACK(menu_get_info_cb) }, + { "Invite", NULL, N_("In_vite..."), NULL, NULL, G_CALLBACK(menu_invite_cb) }, + { "MoreMenu", NULL, N_("M_ore"), NULL, NULL, NULL }, + { "Alias", NULL, N_("Al_ias..."), NULL, NULL, G_CALLBACK(menu_alias_cb) }, + { "Block", PIDGIN_STOCK_TOOLBAR_BLOCK, N_("_Block..."), NULL, NULL, G_CALLBACK(menu_block_cb) }, + { "Unblock", PIDGIN_STOCK_TOOLBAR_UNBLOCK, N_("_Unblock..."), NULL, NULL, G_CALLBACK(menu_unblock_cb) }, + { "Add", GTK_STOCK_ADD, N_("_Add..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, + { "Remove", GTK_STOCK_REMOVE, N_("_Remove..."), NULL, NULL, G_CALLBACK(menu_add_remove_cb) }, + { "InsertLink", PIDGIN_STOCK_TOOLBAR_INSERT_LINK, N_("Insert Lin_k..."), NULL, NULL, G_CALLBACK(menu_insert_link_cb) }, + { "InsertImage", PIDGIN_STOCK_TOOLBAR_INSERT_IMAGE, N_("Insert Imag_e..."), NULL, NULL, G_CALLBACK(menu_insert_image_cb) }, + { "Close", GTK_STOCK_CLOSE, N_("_Close"), NULL, NULL, G_CALLBACK(menu_close_conv_cb) }, + { "OptionsMenu", NULL, N_("_Options"), NULL, NULL, NULL }, +static const GtkToggleActionEntry menu_toggle_entries[] = { + { "EnableLogging", NULL, N_("Enable _Logging"), NULL, NULL, G_CALLBACK(menu_logging_cb), FALSE }, + { "EnableSounds", NULL, N_("Enable _Sounds"), NULL, NULL, G_CALLBACK(menu_sounds_cb), FALSE }, + { "ShowFormattingToolbars", NULL, N_("Show Formatting _Toolbars"), NULL, NULL, G_CALLBACK(menu_toolbar_cb), FALSE }, + { "ShowTimestamps", NULL, N_("Show Ti_mestamps"), NULL, NULL, G_CALLBACK(menu_timestamps_cb), FALSE }, +static const char *conversation_menu = + "<menubar name='Conversation'>" + "<menu action='ConversationMenu'>" + "<menuitem action='NewInstantMessage'/>" + "<menuitem action='Find'/>" + "<menuitem action='ViewLog'/>" + "<menuitem action='SaveAs'/>" + "<menuitem action='ClearScrollback'/>" + "<menu action='MediaMenu'>" + "<menuitem action='AudioCall'/>" + "<menuitem action='VideoCall'/>" + "<menuitem action='AudioVideoCall'/>" + "<menuitem action='SendFile'/>" + "<menuitem action='GetAttention'/>" + "<menuitem action='AddBuddyPounce'/>" + "<menuitem action='GetInfo'/>" + "<menuitem action='Invite'/>" + "<menu action='MoreMenu'/>" + "<menuitem action='Alias'/>" + "<menuitem action='Block'/>" + "<menuitem action='Unblock'/>" + "<menuitem action='Add'/>" + "<menuitem action='Remove'/>" + "<menuitem action='InsertLink'/>" + "<menuitem action='InsertImage'/>" + "<menuitem action='Close'/>" + "<menu action='OptionsMenu'>" + "<menuitem action='EnableLogging'/>" + "<menuitem action='EnableSounds'/>" + "<menuitem action='ShowFormattingToolbars'/>" + "<menuitem action='ShowTimestamps'/>" static GtkItemFactoryEntry menu_items[] =
@@ -3144,15 +3246,7 @@
{ 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);
-item_factory_translate_func (const char *path, gpointer func_data)
sound_method_pref_changed_cb(const char *name, PurplePrefType type,
@@ -3163,19 +3257,18 @@
if (!strcmp(method, "none"))
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
- gtk_widget_set_sensitive(win->menu.sounds, FALSE);
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + gtk_action_set_sensitive(win->menu.sounds, FALSE); PidginConversation *gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
- gtk_widget_set_sensitive(win->menu.sounds, TRUE);
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + gtk_action_set_sensitive(win->menu.sounds, TRUE); @@ -3303,25 +3396,25 @@
purple_prpl_get_media_caps(account,
purple_conversation_get_name(conv));
- gtk_widget_set_sensitive(win->audio_call,
+ gtk_action_set_sensitive(win->audio_call, caps & PURPLE_MEDIA_CAPS_AUDIO
- gtk_widget_set_sensitive(win->video_call,
+ gtk_action_set_sensitive(win->video_call, caps & PURPLE_MEDIA_CAPS_VIDEO
- gtk_widget_set_sensitive(win->audio_video_call,
+ gtk_action_set_sensitive(win->audio_video_call, caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO
} else if (purple_conversation_get_type(conv)
== PURPLE_CONV_TYPE_CHAT) {
/* for now, don't care about chats... */
- 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);
+ 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); - 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);
+ 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); @@ -3332,9 +3425,18 @@
PidginConversation *gtkconv;
+#if GTK_CHECK_VERSION(2,6,0) gtkconv = pidgin_conv_window_get_active_gtkconv(win);
+ more_menu = gtk_ui_manager_get_widget(win->menu.ui, + "/Conversation/ConversationMenu/MoreMenu"); + gtk_widget_show(more_menu); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(more_menu)); + gtkconv = pidgin_conv_window_get_active_gtkconv(win); menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More"));
/* Remove the previous entries */
for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; )
@@ -3390,7 +3492,12 @@
action_items = g_list_delete_link(action_items, action_items);
+#if GTK_CHECK_VERSION(2,6,0) + item = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/OptionsMenu"); + menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item)); menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Options"));
list = purple_conversation_get_extended_menu(conv);
@@ -3426,7 +3533,7 @@
/* The menubar has been deactivated. Make sure the 'More' submenu is regenerated next time
* the 'Conversation' menu pops up. */
- GtkWidget *menuitem = gtk_item_factory_get_item(win->menu.item_factory, N_("/Conversation"));
+ GtkWidget *menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); g_signal_handlers_unblock_by_func(G_OBJECT(menuitem), G_CALLBACK(menubar_activated), win);
g_signal_handlers_disconnect_by_func(G_OBJECT(win->menu.menubar),
G_CALLBACK(focus_out_from_menubar), win);
@@ -3437,128 +3544,142 @@
GtkAccelGroup *accel_group;
+ GtkActionGroup *action_group; - accel_group = gtk_accel_group_new ();
+ action_group = gtk_action_group_new("ConversationActions"); + gtk_action_group_add_actions(action_group, + G_N_ELEMENTS(menu_entries), + gtk_action_group_add_toggle_actions(action_group, + G_N_ELEMENTS(menu_toggle_entries), + gtk_action_group_set_translation_domain(action_group, + win->menu.ui = gtk_ui_manager_new(); + gtk_ui_manager_insert_action_group(win->menu.ui, action_group, 0); + accel_group = gtk_ui_manager_get_accel_group(win->menu.ui); 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,
- gtk_item_factory_create_items(win->menu.item_factory, menu_item_count,
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);
+ if (!gtk_ui_manager_add_ui_from_string(win->menu.ui, conversation_menu, -1, &error)) + g_message("building menus failed: %s", error->message); - gtk_item_factory_get_widget(win->menu.item_factory, "<main>");
+ gtk_ui_manager_get_widget(win->menu.ui, "/Conversation"); + menuitem = gtk_ui_manager_get_widget(win->menu.ui, "/Conversation/ConversationMenu"); + g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(menubar_activated), win); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/View Log"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/ViewLog"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Media/Audio Call"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/AudioCall"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Media/Video Call"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/VideoCall"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Media/Audio\\/Video Call"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/MediaMenu/AudioVideoCall"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Send File..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/SendFile"); g_object_set_data(G_OBJECT(win->window), "get_attention",
- gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Get Attention")));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/GetAttention")); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Add Buddy Pounce..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/AddBuddyPounce"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Get Info"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/GetInfo"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Invite..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Invite"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Alias..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Alias"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Block..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Block"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Unblock..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Unblock"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Add..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Add"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Remove..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/Remove"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Insert Link..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/InsertLink"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Conversation/Insert Image..."));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/ConversationMenu/InsertImage"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Options/Enable Logging"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/OptionsMenu/EnableLogging"); - gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Options/Enable Sounds"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/OptionsMenu/EnableSounds"); 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),
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), - gtk_widget_set_sensitive(win->menu.sounds, FALSE);
+ gtk_action_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"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/OptionsMenu/ShowFormattingToolbars"); win->menu.show_timestamps =
- gtk_item_factory_get_widget(win->menu.item_factory,
- N_("/Options/Show Timestamps"));
+ gtk_ui_manager_get_action(win->menu.ui, + "/Conversation/OptionsMenu/ShowTimestamps"); win->menu.show_icon = NULL;
win->menu.tray = pidgin_menu_tray_new();
@@ -3633,10 +3754,10 @@
if (gtkwin->menu.typing_icon == NULL) {
- gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
- pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray),
- gtkwin->menu.typing_icon,
- _("User is typing..."));
+ gtkwin->menu.typing_icon = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU); + pidgin_menu_tray_append(PIDGIN_MENU_TRAY(gtkwin->menu.tray), + gtkwin->menu.typing_icon, + _("User is typing...")); gtk_image_set_from_stock(GTK_IMAGE(gtkwin->menu.typing_icon), stock_id, GTK_ICON_SIZE_MENU);
@@ -3739,7 +3860,7 @@
if (!(b = purple_find_buddy(account, conv->name)))
gtk_widget_show(win->menu.send_to);
menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(win->menu.send_to));
@@ -3761,6 +3882,7 @@
@@ -3870,6 +3992,7 @@
generate_send_to_items(PidginWindow *win)
GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
@@ -3954,6 +4077,7 @@
gtk_widget_set_sensitive(win->menu.send_to, FALSE);
update_send_to_selection(win);
@@ -4600,12 +4724,21 @@
int pad_top, pad_inside, pad_bottom;
- int total_height = (gtkconv->imhtml->allocation.height + gtkconv->entry->allocation.height);
- int max_height = total_height / 2;
int min_lines = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/minimum_entry_lines");
+ GtkAllocation imhtml_allocation; + GtkAllocation entry_allocation; + GtkAllocation lower_hbox_allocation; + gtk_widget_get_allocation(gtkconv->imhtml, &imhtml_allocation); + gtk_widget_get_allocation(gtkconv->entry, &entry_allocation); + gtk_widget_get_allocation(gtkconv->lower_hbox, &lower_hbox_allocation); + total_height = imhtml_allocation.height + entry_allocation.height; + max_height = total_height / 2; pad_top = gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(gtkconv->entry));
pad_bottom = gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(gtkconv->entry));
@@ -4639,12 +4772,15 @@
height += 2 * focus_width;
- diff = height - gtkconv->entry->allocation.height;
+ diff = height - entry_allocation.height; if (ABS(diff) < oneline.height / 2)
+ purple_debug_info("pidgin", "resizing to %d, %d lines, diff %d\n", + diff + lower_hbox_allocation.height, min_lines, diff); gtk_widget_set_size_request(gtkconv->lower_hbox, -1,
- diff + gtkconv->lower_hbox->allocation.height);
+ diff + lower_hbox_allocation.height); @@ -4691,7 +4827,7 @@
if(prpl_info->set_chat_topic == NULL) {
gtk_editable_set_editable(GTK_EDITABLE(gtkchat->topic_text), FALSE);
- g_signal_connect(GTK_OBJECT(gtkchat->topic_text), "activate",
+ g_signal_connect(GTK_WIDGET(gtkchat->topic_text), "activate", G_CALLBACK(topic_callback), gtkconv);
@@ -4862,7 +4998,7 @@
gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL);
gtk_imhtml_search_clear(GTK_IMHTML(gtkconv->imhtml));
- gtk_widget_hide_all(gtkconv->quickfind.container);
+ gtk_widget_hide(gtkconv->quickfind.container); gtk_widget_grab_focus(gtkconv->entry);
@@ -4872,8 +5008,8 @@
quickfind_process_input(GtkWidget *entry, GdkEventKey *event, PidginConversation *gtkconv)
if (gtk_imhtml_search_find(GTK_IMHTML(gtkconv->imhtml), gtk_entry_get_text(GTK_ENTRY(entry)))) {
gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, NULL);
@@ -4884,7 +5020,7 @@
gtk_widget_modify_base(gtkconv->quickfind.entry, GTK_STATE_NORMAL, &col);
pidgin_conv_end_quickfind(gtkconv);
@@ -4903,8 +5039,12 @@
close = pidgin_create_small_button(gtk_label_new("×"));
gtk_box_pack_start(GTK_BOX(widget), close, FALSE, FALSE, 0);
+#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(close, _("Close Find bar")); gtk_tooltips_set_tip(gtkconv->tooltips, close,
_("Close Find bar"), NULL);
label = gtk_label_new(_("Find:"));
gtk_box_pack_start(GTK_BOX(widget), label, FALSE, FALSE, 10);
@@ -5119,8 +5259,10 @@
PurpleAccount *convaccount = purple_conversation_get_account(conv);
PurpleConnection *gc = purple_account_get_connection(convaccount);
PurplePluginProtocolInfo *prpl_info = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
- if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE))
+ GdkAtom target = gtk_selection_data_get_target(sd); + const guchar *data = gtk_selection_data_get_data(sd); + if (target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) PurpleBlistNode *n = NULL;
@@ -5128,7 +5270,7 @@
PurpleAccount *buddyaccount;
- n = *(PurpleBlistNode **)sd->data;
+ n = *(PurpleBlistNode **) data; if (PURPLE_BLIST_NODE_IS_CONTACT(n))
b = purple_contact_get_priority_buddy((PurpleContact*)n);
@@ -5176,16 +5318,17 @@
pidgin_conv_window_switch_gtkconv(win, gtkconv);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
- else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE))
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + else if (target == gdk_atom_intern("application/x-im-contact", FALSE)) PidginConversation *gtkconv;
- if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account,
+ if (pidgin_parse_x_im_contact((const char *) data, FALSE, &account, &protocol, &username, NULL))
@@ -5216,12 +5359,14 @@
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
- else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) {
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); + else if (target == gdk_atom_intern("text/uri-list", FALSE)) { if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM)
pidgin_dnd_file_manage(sd, convaccount, purple_conversation_get_name(conv));
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); gtk_drag_finish(dc, FALSE, FALSE, t);
@@ -5356,7 +5501,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();
gtkconv->unseen_state = PIDGIN_UNSEEN_NONE;
gtkconv->unseen_count = 0;
@@ -5559,7 +5706,9 @@
+#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(gtkconv->tooltips));
gtkconv->send_history = g_list_first(gtkconv->send_history);
g_list_foreach(gtkconv->send_history, (GFunc)g_free, NULL);
@@ -5623,33 +5772,37 @@
GdkEventButton *btn_event = (GdkEventButton*) event;
PurpleConversation *conv = data;
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); /* strlen("BUDDY " or "HILIT ") == 6 */
- g_return_val_if_fail((tag->name != NULL)
- && (strlen(tag->name) > 6), FALSE);
- buddyname = (tag->name) + 6;
+ g_return_val_if_fail((name != NULL) && (strlen(name) > 6), FALSE); /* emit chat-nick-clicked signal */
if (event->type == GDK_BUTTON_PRESS) {
gint plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(
pidgin_conversations_get_handle(), "chat-nick-clicked",
data, buddyname, btn_event->button));
- if (btn_event->button == 1 &&
- event->type == GDK_2BUTTON_PRESS) {
+ if (btn_event->button == 1 && event->type == GDK_2BUTTON_PRESS) { chat_do_im(PIDGIN_CONVERSATION(conv), buddyname);
- } else if (btn_event->button == 2
- && event->type == GDK_2BUTTON_PRESS) {
- chat_do_info(PIDGIN_CONVERSATION(conv), buddyname);
- } else if (btn_event->button == 3
- && event->type == GDK_BUTTON_PRESS) {
+ } else if (btn_event->button == 2 && event->type == GDK_2BUTTON_PRESS) { + chat_do_info(PIDGIN_CONVERSATION(conv), buddyname); + } else if (btn_event->button == 3 && event->type == GDK_BUTTON_PRESS) { /* we shouldn't display the popup
@@ -5668,10 +5821,14 @@
/* Don't propagate the event any further */
@@ -6529,57 +6686,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(GTK_ACTION(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); - 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); - 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); /* 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); @@ -6624,30 +6781,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) || (prpl_info->add_buddy_with_invite != 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) || (prpl_info->add_buddy_with_invite != 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, (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, (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL));
@@ -6657,18 +6814,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); @@ -6748,8 +6905,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, gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text,
topic ? topic : "", NULL);
@@ -6758,7 +6920,7 @@
if ((fields & PIDGIN_CONV_COLORIZE_TITLE) ||
(fields & PIDGIN_CONV_SET_TITLE) ||
- (fields & PIDGIN_CONV_TOPIC))
+ (fields & PIDGIN_CONV_TOPIC)) @@ -6809,7 +6971,7 @@
- if (!GTK_WIDGET_REALIZED(gtkconv->tab_label))
+ if (!gtk_widget_get_realized(gtkconv->tab_label)) gtk_widget_realize(gtkconv->tab_label);
accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont);
@@ -7124,7 +7286,7 @@
gtk_container_add(GTK_CONTAINER(gtkconv->u.im->icon_container), event);
gtk_event_box_set_visible_window(GTK_EVENT_BOX(event), FALSE);
gtk_widget_add_events(event,
- GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
+ GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK); g_signal_connect(G_OBJECT(event), "button-press-event",
G_CALLBACK(icon_menu), gtkconv);
@@ -7166,11 +7328,14 @@
gint pane_x, pane_y, x_rel;
PidginConversation *gtkconv;
- gdk_window_get_origin(win->notebook->window, &pane_x, &pane_y);
+ GtkAllocation allocation; + gdk_window_get_origin(gtk_widget_get_window(win->notebook), gtkconv = pidgin_conv_window_get_active_gtkconv(win);
- return (x_rel > gtkconv->infopane->allocation.x + gtkconv->infopane->allocation.width / 2);
+ gtk_widget_get_allocation(gtkconv->infopane, &allocation); + return (x_rel > allocation.x + allocation.width / 2); @@ -7188,7 +7353,7 @@
notebook = GTK_NOTEBOOK(win->notebook);
- gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
+ gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); @@ -7198,30 +7363,32 @@
count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(notebook));
for (i = 0; i < count; i++) {
+ GtkAllocation allocation; page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), i);
tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(notebook), page);
+ gtk_widget_get_allocation(tab, &allocation); /* Make sure the tab is not hidden beyond an arrow */
- if (!GTK_WIDGET_DRAWABLE(tab) && gtk_notebook_get_show_tabs(notebook))
+ if (!gtk_widget_is_drawable(tab) && gtk_notebook_get_show_tabs(notebook)) - if (x_rel >= tab->allocation.x - PIDGIN_HIG_BOX_SPACE &&
- x_rel <= tab->allocation.x + tab->allocation.width + PIDGIN_HIG_BOX_SPACE) {
+ if (x_rel >= allocation.x - PIDGIN_HIG_BOX_SPACE && + x_rel <= allocation.x + allocation.width + PIDGIN_HIG_BOX_SPACE) { - if (to_right && x_rel >= tab->allocation.x + tab->allocation.width/2)
+ if (to_right && x_rel >= allocation.x + allocation.width/2) - if (y_rel >= tab->allocation.y - PIDGIN_HIG_BOX_SPACE &&
- y_rel <= tab->allocation.y + tab->allocation.height + PIDGIN_HIG_BOX_SPACE) {
+ if (y_rel >= allocation.y - PIDGIN_HIG_BOX_SPACE && + y_rel <= allocation.y + allocation.height + PIDGIN_HIG_BOX_SPACE) { - if (to_right && y_rel >= tab->allocation.y + tab->allocation.height/2)
+ if (to_right && y_rel >= allocation.y + allocation.height/2) @@ -7328,8 +7495,8 @@
gtkconv = PIDGIN_CONVERSATION(conv);
- gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(win->menu.show_timestamps),
+ gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(win->menu.show_timestamps), (gboolean)GPOINTER_TO_INT(value));
gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml),
@@ -7356,8 +7523,8 @@
gtkconv = PIDGIN_CONVERSATION(conv);
- gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar),
+ gtk_toggle_action_set_active( + GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), (gboolean)GPOINTER_TO_INT(value));
if ((gboolean)GPOINTER_TO_INT(value))
@@ -7963,7 +8130,7 @@
purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/blist/show_protocol_icons",
show_protocol_icons_pref_cb, NULL);
purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/conversations/im/hide_new",
- hide_new_pref_cb, NULL);
+ hide_new_pref_cb, NULL); @@ -8120,7 +8287,7 @@
window_list = g_list_remove(window_list, hidden_convwin);
purple_signal_connect(purple_accounts_get_handle(), "account-status-changed",
- handle, PURPLE_CALLBACK(account_status_changed_cb), NULL);
+ handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); /* Callbacks to update a conversation */
purple_signal_connect(blist_handle, "blist-node-added", handle,
@@ -8304,11 +8471,15 @@
gtk_container_set_border_width(GTK_CONTAINER(warn_close_dialog),
gtk_window_set_resizable(GTK_WINDOW(warn_close_dialog), FALSE);
+ /* TODO: figure out how to set no separator in GTK+ 3.0 */ gtk_dialog_set_has_separator(GTK_DIALOG(warn_close_dialog),
/* Setup the outside spacing. */
- vbox = GTK_DIALOG(warn_close_dialog)->vbox;
+ vbox = gtk_dialog_get_content_area(GTK_DIALOG(warn_close_dialog)); gtk_box_set_spacing(GTK_BOX(vbox), 12);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
@@ -8462,7 +8633,7 @@
always be true after a button press. */
if (!gdk_pointer_is_grabbed())
- gdk_pointer_grab(gtkwin->notebook->window, FALSE,
+ gdk_pointer_grab(gtk_widget_get_window(gtkwin->notebook), FALSE, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, cursor, GDK_CURRENT_TIME);
@@ -8582,6 +8753,9 @@
+ GtkAllocation allocation; + gtk_widget_get_allocation(gtkconv->infopane_hbox, &allocation); if (gtkconv->win->in_drag)
@@ -8589,12 +8763,12 @@
gtkconv->win->in_predrag = TRUE;
gtkconv->win->drag_tab = gtk_notebook_page_num(GTK_NOTEBOOK(gtkconv->win->notebook), gtkconv->tab_cont);
- gdk_window_get_origin(gtkconv->infopane_hbox->window, &nb_x, &nb_y);
- gtkconv->win->drag_min_x = gtkconv->infopane_hbox->allocation.x + nb_x;
- gtkconv->win->drag_min_y = gtkconv->infopane_hbox->allocation.y + nb_y;
- gtkconv->win->drag_max_x = gtkconv->infopane_hbox->allocation.width + gtkconv->win->drag_min_x;
- gtkconv->win->drag_max_y = gtkconv->infopane_hbox->allocation.height + gtkconv->win->drag_min_y;
+ gdk_window_get_origin(gtk_widget_get_window(gtkconv->infopane_hbox), &nb_x, &nb_y); + gtkconv->win->drag_min_x = allocation.x + nb_x; + gtkconv->win->drag_min_y = allocation.y + nb_y; + gtkconv->win->drag_max_x = allocation.width + gtkconv->win->drag_min_x; + gtkconv->win->drag_max_y = allocation.height + gtkconv->win->drag_min_y; gtkconv->win->drag_motion_signal = g_signal_connect(G_OBJECT(gtkconv->win->notebook), "motion_notify_event",
G_CALLBACK(notebook_motion_cb), gtkconv->win);
@@ -8607,6 +8781,7 @@
/* Right click was pressed. Popup the context menu. */
GtkWidget *menu = gtk_menu_new(), *sub;
gboolean populated = populate_menu_with_options(menu, gtkconv, TRUE);
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)) {
@@ -8621,7 +8796,7 @@
gtk_widget_destroy(menu);
gtk_widget_show_all(menu);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, e->button, e->time);
@@ -8636,6 +8811,7 @@
+ GtkAllocation allocation; if (e->button == 2 && e->type == GDK_BUTTON_PRESS) {
PidginConversation *gtkconv;
@@ -8673,7 +8849,7 @@
* Get the relative position of the press event, with regards to
* the position of the notebook.
- gdk_window_get_origin(win->notebook->window, &nb_x, &nb_y);
+ gdk_window_get_origin(gtk_widget_get_window(win->notebook), &nb_x, &nb_y); /* Reset the min/max x/y */
@@ -8685,10 +8861,12 @@
page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(win->notebook), tab_clicked);
tab = gtk_notebook_get_tab_label(GTK_NOTEBOOK(win->notebook), page);
- win->drag_min_x = tab->allocation.x + nb_x;
- win->drag_min_y = tab->allocation.y + nb_y;
- win->drag_max_x = tab->allocation.width + win->drag_min_x;
- win->drag_max_y = tab->allocation.height + win->drag_min_y;
+ gtk_widget_get_allocation(tab, &allocation); + win->drag_min_x = allocation.x + nb_x; + win->drag_min_y = allocation.y + nb_y; + win->drag_max_x = allocation.width + win->drag_min_x; + win->drag_max_y = allocation.height + win->drag_min_y; /* Make sure the click occurred in the tab. */
if (e->x_root < win->drag_min_x ||
@@ -8696,8 +8874,8 @@
e->y_root < win->drag_min_y ||
e->y_root >= win->drag_max_y) {
win->drag_tab = tab_clicked;
@@ -8925,11 +9103,14 @@
close_conv_cb(NULL, gtkconv);
+/* TODO: I don't know if this doable in GTK+ 3.0 */ right_click_menu_cb(GtkNotebook *notebook, GdkEventButton *event, PidginWindow *win)
- GtkWidget *item, *menu;
PidginConversation *gtkconv;
+ GtkWidget *menu = gtk_notebook_get_menu if (event->type != GDK_BUTTON_PRESS || event->button != 3)
@@ -8976,6 +9157,7 @@
remove_edit_entry(PidginConversation *gtkconv, GtkWidget *entry)
@@ -8997,7 +9179,7 @@
alias_key_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
- if (event->keyval == GDK_Escape) {
+ if (event->keyval == GDK_KEY_Escape) { remove_edit_entry(user_data, widget);
@@ -9024,8 +9206,7 @@
buddy = purple_find_buddy(account, name);
- purple_blist_alias_buddy(buddy,
- gtk_entry_get_text(entry));
+ purple_blist_alias_buddy(buddy, gtk_entry_get_text(entry)); } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
@@ -9042,7 +9223,7 @@
PurpleConversation *conv = gtkconv->active_conv;
- if (!GTK_WIDGET_VISIBLE(gtkconv->infopane)) {
+ if (!gtk_widget_get_visible(gtkconv->infopane)) { /* There's already an entry for alias. Let's not create another one. */
@@ -9126,8 +9307,8 @@
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging),
- purple_conversation_is_logging(conv));
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtkconv->win->menu.logging), + purple_conversation_is_logging(conv)); generate_send_to_items(win);
regenerate_options_items(win);
@@ -9137,14 +9318,14 @@
sound_method = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method");
if (strcmp(sound_method, "none") != 0)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
- 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"));
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.sounds), + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_formatting_toolbar), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar")); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(win->menu.show_timestamps), + purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_timestamps")); * We pause icons when they are not visible. If this icon should
@@ -9171,14 +9352,18 @@
make_status_icon_list(const char *stock, GtkWidget *w)
- l = g_list_append(l, gtk_widget_render_icon (w, stock,
- gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow"));
- l = g_list_append(l, gtk_widget_render_icon (w, stock,
- gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow"));
- l = g_list_append(l, gtk_widget_render_icon (w, stock,
- gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow"));
- l = g_list_append(l, gtk_widget_render_icon (w, stock,
- gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow"));
+ gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), "GtkWindow")); + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL), "GtkWindow")); + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_MEDIUM), "GtkWindow")); + gtk_widget_render_icon(w, stock, + gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), "GtkWindow")); @@ -9202,14 +9387,14 @@
static gboolean gtk_conv_configure_cb(GtkWidget *w, GdkEventConfigure *event, gpointer data) {
- if (GTK_WIDGET_VISIBLE(w))
+ if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y);
return FALSE; /* carry on normally */
/* Workaround for GTK+ bug # 169811 - "configure_event" is fired
* when the window is being maximized */
- if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
+ if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) /* don't save off-screen positioning */
@@ -9234,10 +9419,10 @@
pidgin_conv_set_position_size(PidginWindow *win, int conv_x, int conv_y,
int conv_width, int conv_height)
- /* if the window exists, is hidden, we're saving positions, and the
- * position is sane... */
+ /* if the window exists, is hidden, we're saving positions, and the + * position is sane... */ if (win && win->window &&
- !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) {
+ !gtk_widget_get_visible(win->window) && conv_width != 0) { #ifdef _WIN32 /* only override window manager placement on Windows */
/* ...check position is on screen... */
@@ -9322,8 +9507,12 @@
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE);
gtk_notebook_set_show_border(GTK_NOTEBOOK(win->notebook), TRUE);
+ /* TODO: figure out how to add custom stuff to the right-click menu in + GtkNotebook in GTK+ 3.0 */ g_signal_connect(G_OBJECT(win->notebook), "button-press-event",
G_CALLBACK(right_click_menu_cb), win);
gtk_widget_show(win->notebook);
@@ -9392,7 +9581,7 @@
gtk_widget_destroy(win->window);
- g_object_unref(G_OBJECT(win->menu.item_factory));
+ g_object_unref(G_OBJECT(win->menu.ui)); purple_notify_close_with_handle(win);
purple_signals_disconnect_by_handle(win);
@@ -9415,7 +9604,7 @@
pidgin_conv_window_raise(PidginWindow *win)
- gdk_window_raise(GDK_WINDOW(win->window->window));
+ gdk_window_raise(GDK_WINDOW(gtk_widget_get_window(win->window))); @@ -9470,8 +9659,12 @@
gtkconv->close = pidgin_create_small_button(gtk_label_new("×"));
+#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(gtkconv->close, _("Close conversation")); gtk_tooltips_set_tip(gtkconv->tooltips, gtkconv->close,
_("Close conversation"), NULL);
g_signal_connect(gtkconv->close, "clicked", G_CALLBACK (close_conv_cb), gtkconv);
@@ -9586,7 +9779,7 @@
g_signal_connect(G_OBJECT(ebox), "enter-notify-event",
G_CALLBACK(gtkconv_tab_set_tip), gtkconv);
- if (gtkconv->tab_label->parent == NULL) {
+ if (gtk_widget_get_parent(gtkconv->tab_label) == NULL) { /* Pack if it's a new widget */
gtk_box_pack_start(GTK_BOX(gtkconv->tabby), first, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(gtkconv->tabby), gtkconv->tab_label, TRUE, TRUE, 0);
@@ -9607,9 +9800,7 @@
gtk_notebook_set_tab_label(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont, ebox);
- gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont,
+ g_object_set(G_OBJECT(win->notebook), "expand", !tabs_side && !angle, NULL); if (pidgin_conv_window_get_gtkconv_count(win) == 1)
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook),
@@ -9633,8 +9824,12 @@
index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont);
+#if GTK_CHECK_VERSION(2,10,0) + g_object_ref_sink(G_OBJECT(gtkconv->tab_cont)); g_object_ref(gtkconv->tab_cont);
gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont));
gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index);
@@ -9717,7 +9912,7 @@
for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) {
- if (gdkwin == win->window->window)
+ if (gdkwin == gtk_widget_get_window(win->window)) @@ -9839,14 +10034,14 @@
PurpleConversationType type = purple_conversation_get_type(conv->active_conv);
- if (GTK_WIDGET_VISIBLE(w))
+ if (gtk_widget_get_visible(w)) gtk_window_get_position(GTK_WINDOW(w), &x, &y);
return FALSE; /* carry on normally */
/* Workaround for GTK+ bug # 169811 - "configure_event" is fired
* when the window is being maximized */
- if (gdk_window_get_state(w->window) & GDK_WINDOW_STATE_MAXIMIZED)
+ if (gdk_window_get_state(gtk_widget_get_window(w)) & GDK_WINDOW_STATE_MAXIMIZED) /* don't save off-screen positioning */
--- a/pidgin/gtkimhtml.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkimhtml.c Mon Aug 22 22:39:32 2011 +0000
@@ -422,7 +422,7 @@
/* Don't scroll here if we're in the middle of a smooth scroll */
if (scroll && imhtml->scroll_time == NULL &&
- GTK_WIDGET_REALIZED(imhtml))
+ gtk_widget_get_realized(GTK_WIDGET(imhtml))) gtk_imhtml_scroll_to_end(imhtml, FALSE);
@@ -511,18 +511,20 @@
gtk_imhtml_tip_paint (GtkIMHtml *imhtml)
+ cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(imhtml->tip_window)); g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE);
layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip);
- gtk_paint_flat_box (imhtml->tip_window->style, imhtml->tip_window->window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, imhtml->tip_window,
- "tooltip", 0, 0, -1, -1);
- gtk_paint_layout (imhtml->tip_window->style, imhtml->tip_window->window, GTK_STATE_NORMAL,
- FALSE, NULL, imhtml->tip_window, NULL, 4, 4, layout);
+ gtk_paint_flat_box (gtk_widget_get_style(imhtml->tip_window), cr, + GTK_STATE_NORMAL, GTK_SHADOW_OUT, imhtml->tip_window, "tooltip", + gtk_paint_layout (gtk_widget_get_style(imhtml->tip_window), cr, + GTK_STATE_NORMAL, TRUE, imhtml->tip_window, NULL, 4, 4, layout); @@ -534,12 +536,15 @@
PangoFontMetrics *font_metrics;
+ GtkStyle *style = gtk_widget_get_style(imhtml->tip_window); + GtkAllocation allocation; gint gap, x, y, h, w, scr_w, baseline_skip;
g_return_val_if_fail(GTK_IS_IMHTML(imhtml), FALSE);
- if (!imhtml->tip || !GTK_WIDGET_DRAWABLE (GTK_WIDGET(imhtml))) {
+ gtk_widget_get_allocation(GTK_WIDGET(imhtml), &allocation); + if (!imhtml->tip || !gtk_widget_is_drawable(GTK_WIDGET(imhtml))) { @@ -563,11 +568,10 @@
gtk_widget_ensure_style (imhtml->tip_window);
layout = gtk_widget_create_pango_layout(imhtml->tip_window, imhtml->tip);
font = pango_context_load_font(pango_layout_get_context(layout),
- imhtml->tip_window->style->font_desc);
- char *tmp = pango_font_description_to_string(
- imhtml->tip_window->style->font_desc);
+ char *tmp = pango_font_description_to_string(style->font_desc); purple_debug(PURPLE_DEBUG_ERROR, "gtk_imhtml_tip",
"pango_context_load_font() couldn't load font: '%s'\n",
@@ -592,8 +596,8 @@
gdk_window_get_pointer (NULL, &x, &y, NULL);
- if (GTK_WIDGET_NO_WINDOW (GTK_WIDGET(imhtml)))
- y += GTK_WIDGET(imhtml)->allocation.y;
+ if ((!gtk_widget_get_has_window(GTK_WIDGET(imhtml)))) scr_w = gdk_screen_width();
@@ -633,7 +637,7 @@
oldprelit_tag = GTK_IMHTML(imhtml)->prelit_tag;
- gdk_window_get_pointer(GTK_WIDGET(imhtml)->window, NULL, NULL, NULL);
+ gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(imhtml)), NULL, NULL, NULL); gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(imhtml), GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y);
gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(imhtml), &iter, x, y);
@@ -761,6 +765,8 @@
+/* TODO: I think this can be removed for GTK+ 3.0... */ gtk_imhtml_expose_event (GtkWidget *widget,
@@ -788,7 +794,8 @@
gdk_color_parse(GTK_IMHTML(widget)->edit.background, &gcolor);
gdk_cairo_set_source_color(cr, &gcolor);
- gdk_cairo_set_source_color(cr, &(widget->style->base[GTK_WIDGET_STATE(widget)]));
+ gdk_cairo_set_source_color(cr, + &(gtk_widget_get_style(widget)->base[gtk_widget_get_state(widget)])); @@ -894,6 +901,7 @@
static void paste_unformatted_cb(GtkMenuItem *menu, GtkIMHtml *imhtml)
@@ -1065,7 +1073,7 @@
if (primary) /* This was allocated here */
static void gtk_imhtml_primary_clipboard_clear(GtkClipboard *clipboard, GtkIMHtml *imhtml)
@@ -1170,11 +1178,12 @@
GtkIMHtml *imhtml = data;
+ gint length = gtk_selection_data_get_length(selection_data); if (!gtk_text_view_get_editable(GTK_TEXT_VIEW(imhtml)))
- if (imhtml->wbfo || selection_data->length <= 0) {
+ if (imhtml->wbfo || length <= 0) { gtk_clipboard_request_text(clipboard, paste_plaintext_received_cb, imhtml);
@@ -1198,13 +1207,13 @@
- text = g_malloc(selection_data->length + 1);
- memcpy(text, selection_data->data, selection_data->length);
+ text = g_malloc(length + 1); + memcpy(text, gtk_selection_data_get_data(selection_data), length); /* Make sure the paste data is null-terminated. Given that
* we're passed length (but assume later that it is
* null-terminated), this seems sensible to me.
- text[selection_data->length] = '\0';
@@ -1215,10 +1224,10 @@
- if (selection_data->length >= 2 &&
(*(guint16 *)text == 0xfeff || *(guint16 *)text == 0xfffe)) {
- char *utf8 = utf16_to_utf8_with_bom_check(text, selection_data->length);
+ char *utf8 = utf16_to_utf8_with_bom_check(text, length); @@ -1333,7 +1342,7 @@
paste_received_cb, imhtml);
@@ -1579,7 +1588,8 @@
gobject_class->finalize = gtk_imhtml_finalize;
widget_class->drag_motion = gtk_text_view_drag_motion;
- widget_class->expose_event = gtk_imhtml_expose_event;
+ /* TODO: I _think_ this should be removed for GTK+ 3.0 */ + /*widget_class->expose_event = gtk_imhtml_expose_event;*/ parent_size_allocate = widget_class->size_allocate;
widget_class->size_allocate = gtk_imhtml_size_allocate;
parent_style_set = widget_class->style_set;
@@ -1641,20 +1651,20 @@
TRUE, G_PARAM_READABLE));
binding_set = gtk_binding_set_by_class (parent_class);
- gtk_binding_entry_add_signal (binding_set, GDK_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD);
- gtk_binding_entry_add_signal (binding_set, GDK_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC);
- gtk_binding_entry_add_signal (binding_set, GDK_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE);
- gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW);
- gtk_binding_entry_add_signal (binding_set, GDK_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW);
- gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK);
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_b, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_BOLD); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_i, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_ITALIC); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_u, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_UNDERLINE); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK); binding_set = gtk_binding_set_by_class(klass);
- gtk_binding_entry_add_signal (binding_set, GDK_r, GDK_CONTROL_MASK, "format_function_clear", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "message_send", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "message_send", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK, "undo", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0);
- gtk_binding_entry_add_signal (binding_set, GDK_F14, 0, "undo", 0);
- gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text");
+ gtk_binding_entry_add_signal (binding_set, GDK_KEY_r, GDK_CONTROL_MASK, "format_function_clear", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Enter, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_Return, 0, "message_send", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK, "undo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_z, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "redo", 0); + gtk_binding_entry_add_signal (binding_set, GDK_KEY_F14, 0, "undo", 0); + gtk_binding_entry_add_signal(binding_set, GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "paste", 1, G_TYPE_STRING, "text"); static void gtk_imhtml_init (GtkIMHtml *imhtml)
@@ -1881,23 +1891,23 @@
/* can't accept any of the offered targets */
GtkWidget *source_widget;
- suggested_action = context->suggested_action;
+ suggested_action = gdk_drag_context_get_suggested_action(context); source_widget = gtk_drag_get_source_widget (context);
if (source_widget == widget) {
/* Default to MOVE, unless the user has
* pressed ctrl or alt to affect available actions
- if ((context->actions & GDK_ACTION_MOVE) != 0)
+ if ((gdk_drag_context_get_actions(context) & GDK_ACTION_MOVE) != 0) suggested_action = GDK_ACTION_MOVE;
gdk_drag_status (context, suggested_action, time);
- /* TRUE return means don't propagate the drag motion to parent
- * widgets that may also be drop sites.
+ /* TRUE return means don't propagate the drag motion to parent + * widgets that may also be drop sites. @@ -1919,21 +1929,22 @@
- char *text = (char *)sd->data;
+ char *text = (char *) gtk_selection_data_get_data(sd); GtkTextMark *mark = gtk_text_buffer_get_insert(imhtml->text_buffer);
+ gint length = gtk_selection_data_get_length(sd); gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &iter, mark);
- if(gtk_imhtml_get_editable(imhtml) && sd->data){
+ if (gtk_imhtml_get_editable(imhtml) && text) { case GTK_IMHTML_DRAG_URL:
/* TODO: Is it really ok to change sd->data...? */
- purple_str_strip_char((char *)sd->data, '\r');
- links = g_strsplit((char *)sd->data, "\n", 0);
- while((link = links[i]) != NULL){
+ purple_str_strip_char(text, '\r'); + links = g_strsplit(text, "\n", 0); + while ((link = links[i]) != NULL) { if (gtk_imhtml_is_protocol(link)) {
@@ -1955,7 +1966,7 @@
case GTK_IMHTML_DRAG_HTML:
@@ -1971,8 +1982,8 @@
* See also the comment on text/html here:
* http://mail.gnome.org/archives/gtk-devel-list/2001-September/msg00114.html
- if (sd->length >= 2 && !g_utf8_validate(text, sd->length - 1, NULL)) {
- utf8 = utf16_to_utf8_with_bom_check(text, sd->length);
+ if (length >= 2 && !g_utf8_validate(text, length - 1, NULL)) { + utf8 = utf16_to_utf8_with_bom_check(text, length); purple_debug_warning("gtkimhtml", "g_convert from UTF-16 failed in drag_rcv_cb\n");
@@ -2001,7 +2012,8 @@
gtk_drag_finish(dc, FALSE, FALSE, t);
- gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
+ gtk_drag_finish(dc, TRUE, + gdk_drag_context_get_actions(dc) == GDK_ACTION_MOVE, t); gtk_drag_finish(dc, FALSE, FALSE, t);
@@ -2532,8 +2544,8 @@
static gboolean smooth_scroll_cb(gpointer data)
GtkIMHtml *imhtml = data;
- GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment;
- gdouble max_val = adj->upper - adj->page_size;
+ GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); + gdouble max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); gdouble scroll_val = gtk_adjustment_get_value(adj) + ((max_val - gtk_adjustment_get_value(adj)) / 3);
g_return_val_if_fail(imhtml->scroll_time != NULL, FALSE);
@@ -2556,9 +2568,10 @@
static gboolean scroll_idle_cb(gpointer data)
GtkIMHtml *imhtml = data;
- GtkAdjustment *adj = GTK_TEXT_VIEW(imhtml)->vadjustment;
- gtk_adjustment_set_value(adj, adj->upper - adj->page_size);
+ GtkAdjustment *adj = gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(imhtml)); + gtk_adjustment_set_value(adj, gtk_adjustment_get_upper(adj) - + gtk_adjustment_get_page_size(adj)); @@ -4216,9 +4229,14 @@
for (l = tags; l; l = l->next) {
GtkTextTag *tag = l->data;
- if (tag->name && !strncmp(tag->name, prefix, len))
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); + if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, i, e);
@@ -4234,9 +4252,14 @@
for (l = tags; l; l = l->next) {
GtkTextTag *tag = l->data;
- if (tag->name && !strncmp(tag->name, prefix, len))
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); + if (name && !strncmp(name, prefix, len)) gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, &iter, e);
@@ -4357,11 +4380,16 @@
gtk_text_iter_begins_tag(start, tag) && /* the tag starts with the selection */
(!gtk_text_iter_has_tag(end, tag) || /* the tag ends within the selection */
gtk_text_iter_ends_tag(end, tag))) {
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); gtk_text_buffer_remove_tag(imhtml->text_buffer, tag, start, end);
- strncmp(tag->name, "LINK ", 5) == 0 && imhtml->edit.link) {
+ if (name && strncmp(name, "LINK ", 5) == 0 && imhtml->edit.link) { gtk_imhtml_toggle_link(imhtml, NULL);
@@ -4583,27 +4611,32 @@
for (l = tags; l != NULL; l = l->next) {
GtkTextTag *tag = GTK_TEXT_TAG(l->data);
- if (strcmp(tag->name, "BOLD") == 0)
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); + if (strcmp(name, "BOLD") == 0) imhtml->edit.bold = TRUE;
- else if (strcmp(tag->name, "ITALICS") == 0)
+ else if (strcmp(name, "ITALICS") == 0) imhtml->edit.italic = TRUE;
- else if (strcmp(tag->name, "UNDERLINE") == 0)
+ else if (strcmp(name, "UNDERLINE") == 0) imhtml->edit.underline = TRUE;
- else if (strcmp(tag->name, "STRIKE") == 0)
+ else if (strcmp(name, "STRIKE") == 0) imhtml->edit.strike = TRUE;
- else if (strncmp(tag->name, "FORECOLOR ", 10) == 0)
- imhtml->edit.forecolor = g_strdup(&(tag->name)[10]);
- else if (strncmp(tag->name, "BACKCOLOR ", 10) == 0)
- imhtml->edit.backcolor = g_strdup(&(tag->name)[10]);
- else if (strncmp(tag->name, "FONT FACE ", 10) == 0)
- imhtml->edit.fontface = g_strdup(&(tag->name)[10]);
- else if (strncmp(tag->name, "FONT SIZE ", 10) == 0)
- imhtml->edit.fontsize = strtol(&(tag->name)[10], NULL, 10);
- else if ((strncmp(tag->name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter))
+ else if (strncmp(name, "FORECOLOR ", 10) == 0) + imhtml->edit.forecolor = g_strdup(&(name)[10]); + else if (strncmp(name, "BACKCOLOR ", 10) == 0) + imhtml->edit.backcolor = g_strdup(&(name)[10]); + else if (strncmp(name, "FONT FACE ", 10) == 0) + imhtml->edit.fontface = g_strdup(&(name)[10]); + else if (strncmp(name, "FONT SIZE ", 10) == 0) + imhtml->edit.fontsize = strtol(&(name)[10], NULL, 10); + else if ((strncmp(name, "LINK ", 5) == 0) && !gtk_text_iter_is_end(&iter)) @@ -4894,6 +4927,8 @@
gtk_text_buffer_end_user_action(imhtml->text_buffer);
+/* TODO: I think this can be removed for GTK+ 3.0... */ image_expose(GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
@@ -4901,9 +4936,10 @@
/* In case the smiley gets removed from the imhtml before it gets removed from the queue */
-static void animated_smiley_destroy_cb(GtkObject *widget, GtkIMHtml *imhtml)
+static void animated_smiley_destroy_cb(GtkWidget *widget, GtkIMHtml *imhtml) GList *l = imhtml->animations->head;
@@ -4974,7 +5010,7 @@
- imhtml->num_animations++;
+ imhtml->num_animations++; g_signal_connect(G_OBJECT(icon), "destroy", G_CALLBACK(animated_smiley_destroy_cb), imhtml);
g_queue_push_tail(imhtml->animations, icon);
@@ -4998,7 +5034,9 @@
* images, and ensures that they are handled by the image
* itself, without propagating to the textview and causing
+ /* TODO: I think this should be removed for GTK+ 3.0? g_signal_connect(G_OBJECT(icon), "expose-event", G_CALLBACK(image_expose), NULL);
@@ -5092,22 +5130,29 @@
static const gchar *tag_to_html_start(GtkTextTag *tag)
g_return_val_if_fail(name != NULL, "");
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) {
} else if (strcmp(name, "ITALICS") == 0) {
} else if (strcmp(name, "UNDERLINE") == 0) {
} else if (strcmp(name, "STRIKE") == 0) {
} else if (strncmp(name, "LINK ", 5) == 0) {
char *tmp = g_object_get_data(G_OBJECT(tag), "link_url");
g_snprintf(buf, sizeof(buf), "<a href=\"%s\">", tmp);
buf[sizeof(buf)-1] = '\0';
@@ -5117,18 +5162,29 @@
} else if (strncmp(name, "FORECOLOR ", 10) == 0) {
g_snprintf(buf, sizeof(buf), "<font color=\"%s\">", &name[10]);
} else if (strncmp(name, "BACKCOLOR ", 10) == 0) {
g_snprintf(buf, sizeof(buf), "<font back=\"%s\">", &name[10]);
} else if (strncmp(name, "BACKGROUND ", 10) == 0) {
g_snprintf(buf, sizeof(buf), "<body bgcolor=\"%s\">", &name[11]);
} else if (strncmp(name, "FONT FACE ", 10) == 0) {
g_snprintf(buf, sizeof(buf), "<font face=\"%s\">", &name[10]);
} else if (strncmp(name, "FONT SIZE ", 10) == 0) {
g_snprintf(buf, sizeof(buf), "<font size=\"%s\">", &name[10]);
@@ -5191,6 +5247,7 @@
g_snprintf(str, sizeof(buf) - (str - buf), "'>");
return (empty ? "" : buf);
@@ -5198,30 +5255,40 @@
static const gchar *tag_to_html_end(GtkTextTag *tag)
g_return_val_if_fail(name != NULL, "");
+ g_object_get(G_OBJECT(tag), "name", &name, NULL); if (strcmp(name, "BOLD") == 0) {
} else if (strcmp(name, "ITALICS") == 0) {
} else if (strcmp(name, "UNDERLINE") == 0) {
} else if (strcmp(name, "STRIKE") == 0) {
} else if (strncmp(name, "LINK ", 5) == 0) {
} else if (strncmp(name, "FORECOLOR ", 10) == 0) {
} else if (strncmp(name, "BACKCOLOR ", 10) == 0) {
} else if (strncmp(name, "BACKGROUND ", 10) == 0) {
} else if (strncmp(name, "FONT FACE ", 10) == 0) {
} else if (strncmp(name, "FONT SIZE ", 10) == 0) {
const char *props[] = {"weight-set", "foreground-set", "background-set",
@@ -5234,6 +5301,8 @@
--- a/pidgin/gtkimhtmltoolbar.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkimhtmltoolbar.c Mon Aug 22 22:39:32 2011 +0000
@@ -124,11 +124,15 @@
- sel = GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->fontsel);
- gtk_widget_hide_all(gtk_widget_get_parent(sel->size_entry));
- gtk_widget_show_all(sel->family_list);
- gtk_widget_show(gtk_widget_get_parent(sel->family_list));
- gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(sel->family_list)));
+ sel = GTK_FONT_SELECTION( + gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))); + gtk_widget_hide(gtk_widget_get_parent( + gtk_font_selection_get_size_entry(sel))); + gtk_widget_show_all(gtk_font_selection_get_family_list(sel)); + gtk_widget_show(gtk_widget_get_parent( + gtk_font_selection_get_family_list(sel))); + gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent( + gtk_font_selection_get_family_list(sel)))); @@ -191,10 +195,12 @@
g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event",
G_CALLBACK(destroy_toolbar_font), toolbar);
- g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button), "clicked",
- G_CALLBACK(apply_font), toolbar->font_dialog);
- g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button), "clicked",
- G_CALLBACK(cancel_toolbar_font), toolbar);
+ g_signal_connect(G_OBJECT( + gtk_font_selection_dialog_get_ok_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(apply_font), toolbar->font_dialog); + g_signal_connect(G_OBJECT( + gtk_font_selection_dialog_get_cancel_button(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog))), + "clicked", G_CALLBACK(cancel_toolbar_font), toolbar); g_signal_connect_after(G_OBJECT(toolbar->font_dialog), "realize",
G_CALLBACK(realize_toolbar_font), toolbar);
@@ -253,9 +259,12 @@
char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(toolbar->imhtml));
if (!toolbar->fgcolor_dialog) {
+ GtkWidget *cancel_button; toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
- colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel;
+ gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); gdk_color_parse(color, &fgcolor);
gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
@@ -264,12 +273,13 @@
g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar);
+ g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->fgcolor_dialog), "cancel-button", &cancel_button, NULL); g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event",
G_CALLBACK(destroy_toolbar_fgcolor), toolbar);
- g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button), "clicked",
- G_CALLBACK(do_fgcolor), colorsel);
- g_signal_connect(G_OBJECT (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button), "clicked",
- G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
+ g_signal_connect(G_OBJECT(ok_button), "clicked", G_CALLBACK(do_fgcolor), colorsel); + g_signal_connect(G_OBJECT(cancel_button), "clicked", + G_CALLBACK(cancel_toolbar_fgcolor), toolbar); gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog));
@@ -333,9 +343,13 @@
char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(toolbar->imhtml));
if (!toolbar->bgcolor_dialog) {
+ GtkWidget *cancel_button; toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Background Color"));
- colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel;
+ gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)); gdk_color_parse(color, &bgcolor);
gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
@@ -344,11 +358,14 @@
g_object_set_data(G_OBJECT(colorsel), "purple_toolbar", toolbar);
+ g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "ok-button", &ok_button, NULL); + g_object_get(G_OBJECT(toolbar->bgcolor_dialog), "cancel-button", g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event",
G_CALLBACK(destroy_toolbar_bgcolor), toolbar);
- g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button), "clicked",
- G_CALLBACK(do_bgcolor), colorsel);
- g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button), "clicked",
+ g_signal_connect(G_OBJECT(ok_button), "clicked", + G_CALLBACK(do_bgcolor), colorsel); + g_signal_connect(G_OBJECT(cancel_button), "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
@@ -461,12 +478,12 @@
static void insert_hr_cb(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
- ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)));
- gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins);
+ ins = gtk_text_buffer_get_insert(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml))); + gtk_text_buffer_get_iter_at_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(toolbar->imhtml)), &iter, ins); hr = gtk_imhtml_hr_new();
gtk_imhtml_hr_add_to(hr, GTK_IMHTML(toolbar->imhtml), &iter);
@@ -658,7 +675,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); gtk_tooltips_set_tip(toolbar->tooltips, button, face, NULL);
/* these look really weird with borders */
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
@@ -672,7 +693,11 @@
g_snprintf(tip, sizeof(tip),
_("This smiley is disabled because a custom smiley exists for this shortcut:\n %s"),
+#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, tip); gtk_tooltips_set_tip(toolbar->tooltips, button, tip, NULL);
gtk_widget_set_sensitive(button, FALSE);
/* Remove the button if the smiley is destroyed */
@@ -714,7 +739,7 @@
smiley_dialog_input_cb(GtkWidget *dialog, GdkEvent *event, GtkIMHtmlToolbar *toolbar)
- if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_Escape) ||
+ if ((event->type == GDK_KEY_PRESS && event->key.keyval == GDK_KEY_Escape) || (event->type == GDK_BUTTON_PRESS && event->button.button == 1))
close_smiley_dialog(toolbar);
@@ -1084,19 +1109,21 @@
GtkWidget *widget = GTK_WIDGET(data);
- gint ythickness = widget->style->ythickness;
+ GtkAllocation allocation; + gint ythickness = gtk_widget_get_style(widget)->ythickness; + gtk_widget_get_allocation(widget, &allocation); gtk_widget_size_request(GTK_WIDGET (menu), &menu_req);
- gdk_window_get_origin(widget->window, x, y);
- *x += widget->allocation.x;
- *y += widget->allocation.y + widget->allocation.height;
+ gdk_window_get_origin(gtk_widget_get_window(widget), x, y); + *y += allocation.y + allocation.height; pidgin_menu_position_func_helper(menu, x, y, push_in, data);
if (savy > *y + ythickness + 1)
- *y -= widget->allocation.height;
+ *y -= allocation.height; @@ -1155,7 +1182,9 @@
+#if !GTK_CHECK_VERSION(2,12,0) gtk_object_sink(GTK_OBJECT(toolbar->tooltips));
menu = g_object_get_data(object, "font_menu");
@@ -1186,7 +1215,7 @@
- wide = GTK_WIDGET_VISIBLE(toolbar->bold);
+ wide = gtk_widget_get_visible(toolbar->bold); item = gtk_menu_item_new_with_mnemonic(wide ? _("Group Items") : _("Ungroup Items"));
@@ -1252,7 +1281,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); gtk_tooltips_set_tip(toolbar->tooltips, button, buttons[iter].tooltip, NULL);
button = gtk_vseparator_new();
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
@@ -1263,7 +1296,11 @@
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(send_attention_cb), toolbar);
g_object_set_data(G_OBJECT(toolbar), "attention", button);
+#if GTK_CHECK_VERSION(2,12,0) + gtk_widget_set_tooltip_text(button, _("Send Attention")); gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL);
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0);
@@ -1273,7 +1310,7 @@
button_visibility_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
- if (GTK_WIDGET_VISIBLE(button))
+ if (gtk_widget_get_visible(button)) @@ -1282,7 +1319,7 @@
button_sensitiveness_changed(GtkWidget *button, gpointer dontcare, GtkWidget *item)
- gtk_widget_set_sensitive(item, GTK_WIDGET_IS_SENSITIVE(button));
+ gtk_widget_set_sensitive(item, gtk_widget_get_sensitive(button)); @@ -1305,10 +1342,10 @@
gconstpointer value, gpointer toolbar)
- gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "lean-view"));
+ gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "lean-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "wide-view"));
- gtk_widget_hide_all(g_object_get_data(G_OBJECT(toolbar), "wide-view"));
+ gtk_widget_hide(g_object_get_data(G_OBJECT(toolbar), "wide-view")); gtk_widget_show_all(g_object_get_data(G_OBJECT(toolbar), "lean-view"));
@@ -1361,7 +1398,9 @@
toolbar->smiley_dialog = NULL;
toolbar->image_dialog = NULL;
+#if !GTK_CHECK_VERSION(2,12,0) toolbar->tooltips = gtk_tooltips_new();
gtk_box_set_spacing(GTK_BOX(toolbar), 3);
--- a/pidgin/gtkstatusbox.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkstatusbox.c Mon Aug 22 22:39:32 2011 +0000
@@ -82,9 +82,10 @@
static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed);
static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed);
static void pidgin_status_box_changed(PidginStatusBox *box);
-static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);
+static void pidgin_status_box_get_preferred_height (GtkWidget *widget, + gint *minimum_height, gint *natural_height); static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);
+static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box);
static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
static void pidgin_status_box_popup(PidginStatusBox *box);
@@ -282,7 +283,7 @@
if (!message || !*message)
- gtk_widget_hide_all(status_box->vbox);
+ gtk_widget_hide(status_box->vbox); status_box->imhtml_visible = FALSE;
@@ -343,9 +344,10 @@
icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y,
GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box)
- gchar *name = (gchar *)sd->data;
- if ((sd->length >= 0) && (sd->format == 8)) {
+ gchar *name = (gchar *) gtk_selection_data_get_data(sd); + if ((gtk_selection_data_get_length(sd) >= 0) + && (gtk_selection_data_get_format(sd) == 8)) { /* Well, it looks like the drag event was cool.
* Let's do something with it */
if (!g_ascii_strncasecmp(name, "file://", 7)) {
@@ -419,7 +421,7 @@
icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
- gdk_window_set_cursor(widget->window, box->hand_cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover);
@@ -427,7 +429,7 @@
icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box)
- gdk_window_set_cursor(widget->window, box->arrow_cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), box->arrow_cursor); gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ;
@@ -615,9 +617,9 @@
parent_class = g_type_class_peek_parent(klass);
widget_class = (GtkWidgetClass*)klass;
- widget_class->size_request = pidgin_status_box_size_request;
+ widget_class->get_preferred_height = pidgin_status_box_get_preferred_height; widget_class->size_allocate = pidgin_status_box_size_allocate;
- widget_class->expose_event = pidgin_status_box_expose_event;
+ widget_class->draw = pidgin_status_box_draw; container_class->child_type = pidgin_status_box_child_type;
container_class->forall = pidgin_status_box_forall;
@@ -931,7 +933,7 @@
if (!purple_savedstatus_is_transient(saved_status) || !message || !*message)
status_box->imhtml_visible = FALSE;
- gtk_widget_hide_all(status_box->vbox);
+ gtk_widget_hide(status_box->vbox); @@ -1135,7 +1137,7 @@
static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box)
- if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab || event->keyval == GDK_ISO_Left_Tab)
+ if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) /* If last inserted character is a tab, then remove the focus from here */
GtkWidget *top = gtk_widget_get_toplevel(w);
@@ -1148,7 +1150,7 @@
/* Reset the status if Escape was pressed */
- if (event->keyval == GDK_Escape)
+ if (event->keyval == GDK_KEY_Escape) purple_timeout_remove(status_box->typing);
@@ -1299,13 +1301,15 @@
GtkRequisition popup_req;
GtkPolicyType hpolicy, vpolicy;
- gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y);
- *x += GTK_WIDGET(status_box)->allocation.x;
- *y += GTK_WIDGET(status_box)->allocation.y;
- *width = GTK_WIDGET(status_box)->allocation.width;
+ GtkAllocation allocation; + gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation); + gdk_window_get_origin (gtk_widget_get_window(GTK_WIDGET(status_box)), x, y); + *width = allocation.width; hpolicy = vpolicy = GTK_POLICY_NEVER;
g_object_set(G_OBJECT(status_box->scrolled_window),
@@ -1328,7 +1332,7 @@
screen = gtk_widget_get_screen (GTK_WIDGET (status_box));
monitor_num = gdk_screen_get_monitor_at_window (screen,
- GTK_WIDGET (status_box)->window);
+ gtk_widget_get_window(GTK_WIDGET (status_box))); gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
@@ -1336,13 +1340,13 @@
else if (*x + *width > monitor.x + monitor.width)
*x = monitor.x + monitor.width - *width;
- if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height)
- *y += GTK_WIDGET(status_box)->allocation.height;
+ if (*y + allocation.height + *height <= monitor.y + monitor.height) + *y += allocation.height; else if (*y - *height >= monitor.y)
- else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y)
+ else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y) - *y += GTK_WIDGET(status_box)->allocation.height;
+ *y += allocation.height; *height = monitor.y + monitor.height - *y;
@@ -1375,7 +1379,7 @@
if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0)
- gdk_display_pointer_ungrab (gdk_drawable_get_display (window), activate_time);
+ gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time); @@ -1394,7 +1398,7 @@
gtk_window_move (GTK_WINDOW (box->popup_window), x, y);
gtk_widget_show(box->popup_window);
gtk_widget_grab_focus (box->tree_view);
- if (!popup_grab_on_window (box->popup_window->window,
+ if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window), GDK_CURRENT_TIME, TRUE)) {
gtk_widget_hide (box->popup_window);
@@ -1425,10 +1429,10 @@
toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box)
if (!box->popup_in_progress) {
pidgin_status_box_popup (box);
box->popup_in_progress = TRUE;
@@ -1660,7 +1664,7 @@
GdkEventKey *event, PidginStatusBox *box)
if (box->popup_in_progress) {
- if (event->keyval == GDK_Escape) {
+ if (event->keyval == GDK_KEY_Escape) { pidgin_status_box_popdown(box);
@@ -1671,9 +1675,9 @@
if (gtk_tree_selection_get_selected(sel, NULL, &iter)) {
path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter);
- if (event->keyval == GDK_Return) {
+ if (event->keyval == GDK_KEY_Return) { treeview_activate_current_selection(box, path);
- } else if (event->keyval == GDK_Delete) {
+ } else if (event->keyval == GDK_KEY_Delete) { tree_view_delete_current_selection(box, path);
@@ -1749,7 +1753,7 @@
- GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW);
+ gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); status_box->imhtml_visible = FALSE;
status_box->network_available = purple_network_is_available();
status_box->connecting = FALSE;
@@ -1925,24 +1929,27 @@
-pidgin_status_box_size_request(GtkWidget *widget,
- GtkRequisition *requisition)
+pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, - GtkRequisition box_req;
- gint border_width = GTK_CONTAINER (widget)->border_width;
- gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition);
- /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
- requisition->height = MAX(requisition->height, 34);
- requisition->height += border_width * 2;
+ gint box_min_height, box_nat_height; + gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); + gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->toggle_button, + minimum_height, natural_height); + *minimum_height = MAX(*minimum_height, 34) + border_width * 2; + *natural_height = MAX(*natural_height, 34) + border_width * 2; /* If the gtkimhtml is visible, then add some additional padding */
- gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req);
- if (box_req.height > 1)
- requisition->height += box_req.height + border_width * 2;
- requisition->width = 1;
+ gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->vbox, + &box_min_height, &box_nat_height); + if (box_min_height > 1) + *minimum_height += box_min_height + border_width * 2; + if (box_nat_height > 1) + *natural_height += box_nat_height + border_width * 2; @@ -1990,9 +1997,9 @@
GtkAllocation *allocation)
PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
- GtkRequisition req = {0,0};
+ GtkRequisition req = {0,40}; GtkAllocation parent_alc, box_alc, icon_alc;
- gint border_width = GTK_CONTAINER (widget)->border_width;
+ gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); gtk_widget_size_request(status_box->toggle_button, &req);
/* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */
@@ -2031,19 +2038,24 @@
gtk_widget_size_allocate(status_box->icon_box, &icon_alc);
gtk_widget_size_allocate(status_box->toggle_button, &parent_alc);
- widget->allocation = *allocation;
+ gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); + purple_debug_info("pidgin", "statusbox allocation: width = %d, height = %d\n", + allocation->width, allocation->height); -pidgin_status_box_expose_event(GtkWidget *widget,
+pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget);
- gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event);
- gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event);
+ gtk_widget_draw(status_box->vbox, cr); + gtk_widget_draw(status_box->toggle_button, cr); if (status_box->icon_box && status_box->icon_opaque) {
- gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL,
- status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1,
+ GtkAllocation allocation; + gtk_widget_get_allocation(status_box->icon_box, &allocation); + gtk_paint_box(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, + status_box->icon_box, "button", allocation.x-1, allocation.y-1, @@ -2353,7 +2365,7 @@
message = pidgin_status_box_get_message(status_box);
if (!message || !*message)
- gtk_widget_hide_all(status_box->vbox);
+ gtk_widget_hide(status_box->vbox); status_box->imhtml_visible = FALSE;
@@ -2625,7 +2637,7 @@
purple_timeout_remove(status_box->typing);
- if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
+ if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR)
@@ -2687,7 +2699,7 @@
- if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
+ if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) if (status_box->imhtml_visible)
@@ -2707,7 +2719,7 @@
- gtk_widget_hide_all(status_box->vbox);
+ gtk_widget_hide(status_box->vbox); activate_currently_selected_status(status_box); /* This is where we actually set the status */
@@ -2743,7 +2755,7 @@
static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data)
PidginStatusBox *status_box = (PidginStatusBox*)data;
- if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box)))
+ if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) if (status_box->typing != 0) {
pidgin_status_box_pulse_typing(status_box);
--- a/pidgin/gtkutils.c Mon Aug 22 22:25:09 2011 +0000
+++ b/pidgin/gtkutils.c Mon Aug 22 22:39:32 2011 +0000
@@ -70,7 +70,7 @@
#include "pidgin/minidialog.h"
@@ -180,7 +180,6 @@
wnd = GTK_WINDOW(gtk_dialog_new());
pidgin_window_init(wnd, title, border_width, role, resizable);
- g_object_set(G_OBJECT(wnd), "has-separator", FALSE, NULL);
@@ -188,7 +187,7 @@
pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing)
- GtkBox *vbox = GTK_BOX(GTK_DIALOG(dialog)->vbox);
+ GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_box_set_homogeneous(vbox, homogeneous);
gtk_box_set_spacing(vbox, spacing);
@@ -196,12 +195,12 @@
GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog)
- return GTK_DIALOG(dialog)->vbox;
+ return gtk_dialog_get_content_area(GTK_DIALOG(dialog)); GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog)
- return GTK_DIALOG(dialog)->action_area;
+ return gtk_dialog_get_action_area(GTK_DIALOG(dialog)); GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
@@ -292,7 +291,7 @@
- sensitivity = GTK_WIDGET_IS_SENSITIVE(to_toggle);
+ sensitivity = gtk_widget_get_sensitive(to_toggle); gtk_widget_set_sensitive(to_toggle, !sensitivity);
@@ -309,7 +308,7 @@
- sensitivity = GTK_WIDGET_IS_SENSITIVE(element);
+ sensitivity = gtk_widget_get_sensitive(element); gtk_widget_set_sensitive(element, !sensitivity);
@@ -321,7 +320,7 @@
- if (GTK_WIDGET_VISIBLE(to_toggle))
+ if (gtk_widget_get_visible(to_toggle)) gtk_widget_hide(to_toggle);
gtk_widget_show(to_toggle);
@@ -522,68 +521,35 @@
-aop_option_menu_get_selected(GtkWidget *optmenu, GtkWidget **p_item)
+aop_option_menu_get_selected(GtkWidget *optmenu) - GtkWidget *menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu));
- GtkWidget *item = gtk_menu_get_active(GTK_MENU(menu));
- return item ? g_object_get_data(G_OBJECT(item), "aop_per_item_data") : NULL;
+ g_return_val_if_fail(optmenu != NULL, NULL); + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(optmenu), &iter)) + gtk_tree_model_get(gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)), &iter, 2, &data, -1); aop_menu_cb(GtkWidget *optmenu, GCallback cb)
- gpointer per_item_data;
- per_item_data = aop_option_menu_get_selected(optmenu, &item);
- ((void (*)(GtkWidget *, gpointer, gpointer))cb)(item, per_item_data, g_object_get_data(G_OBJECT(optmenu), "user_data"));
+ ((void (*)(GtkWidget *, gpointer, gpointer))cb)(optmenu, + aop_option_menu_get_selected(optmenu), + g_object_get_data(G_OBJECT(optmenu), "user_data"));
-aop_menu_item_new(GtkSizeGroup *sg, GdkPixbuf *pixbuf, const char *lbl, gpointer per_item_data, const char *data)
+aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu)
- item = gtk_menu_item_new();
- hbox = gtk_hbox_new(FALSE, 4);
- image = gtk_image_new();
- image = gtk_image_new_from_pixbuf(pixbuf);
- gtk_widget_show(image);
- gtk_size_group_add_widget(sg, image);
- label = gtk_label_new (lbl);
- gtk_widget_show (label);
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
- gtk_container_add(GTK_CONTAINER(item), hbox);
- gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0);
- g_object_set_data(G_OBJECT (item), data, per_item_data);
- g_object_set_data(G_OBJECT (item), "aop_per_item_data", per_item_data);
- pidgin_set_accessible_label(item, label);
+ gtk_combo_box_set_model(GTK_COMBO_BOX(optmenu), new_aop_menu->model); + gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), new_aop_menu->default_item); + g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free); @@ -624,16 +590,19 @@
aop_option_menu_new(AopMenu *aop_menu, GCallback cb, gpointer user_data)
- optmenu = gtk_option_menu_new();
+ GtkWidget *optmenu = NULL; + GtkCellRenderer *cr = NULL; + optmenu = gtk_combo_box_new(); gtk_widget_show(optmenu);
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), aop_menu->menu);
- if (aop_menu->default_item != -1)
- gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), aop_menu->default_item);
- g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", aop_menu, (GDestroyNotify)g_free);
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_pixbuf_new(), FALSE); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "pixbuf", 0); + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(optmenu), cr = gtk_cell_renderer_text_new(), TRUE); + gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(optmenu), cr, "text", 1); + aop_option_menu_replace_menu(optmenu, aop_menu); + if (aop_menu->default_item == -1) + gtk_combo_box_set_active(GTK_COMBO_BOX(optmenu), 0); g_object_set_data(G_OBJECT(optmenu), "user_data", user_data);
g_signal_connect(G_OBJECT(optmenu), "changed", G_CALLBACK(aop_menu_cb), cb);
@@ -642,32 +611,20 @@
-aop_option_menu_replace_menu(GtkWidget *optmenu, AopMenu *new_aop_menu)
- if (gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)))
- gtk_option_menu_remove_menu(GTK_OPTION_MENU(optmenu));
- gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), new_aop_menu->menu);
- if (new_aop_menu->default_item != -1)
- gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), new_aop_menu->default_item);
- g_object_set_data_full(G_OBJECT(optmenu), "aop_menu", new_aop_menu, (GDestroyNotify)g_free);
aop_option_menu_select_by_data(GtkWidget *optmenu, gpointer data)
- for (idx = 0, llItr = GTK_MENU_SHELL(gtk_option_menu_get_menu(GTK_OPTION_MENU(optmenu)))->children;
- llItr = llItr->next, idx++) {
- if (data == g_object_get_data(G_OBJECT(llItr->data), "aop_per_item_data")) {
- gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), idx);
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(optmenu)); + if (gtk_tree_model_get_iter_first(model, &iter)) { + gtk_tree_model_get(model, &iter, 2, &iter_data, -1); + if (iter_data == data) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(optmenu), &iter); + } while (gtk_tree_model_iter_next(model, &iter)); @@ -677,16 +634,17 @@
AopMenu *aop_menu = NULL;
GdkPixbuf *pixbuf = NULL;
const char *gtalk_name = NULL, *facebook_name = NULL;
+ ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu));
aop_menu->default_item = -1;
- aop_menu->menu = gtk_menu_new();
- gtk_widget_show(aop_menu->menu);
- sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ aop_menu->model = GTK_TREE_MODEL(ls); if (purple_find_prpl("prpl-jabber")) {
gtalk_name = _("Google Talk");
@@ -702,14 +660,11 @@
if (gtalk_name && strcmp(gtalk_name, plugin->info->name) < 0) {
char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols",
"16", "google-talk.png", NULL);
pixbuf = pidgin_pixbuf_new_from_file(filename);
- gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
- item = aop_menu_item_new(sg, pixbuf, gtalk_name, "prpl-jabber", "protocol"));
- g_object_set_data(G_OBJECT(item), "fakegoogle", GINT_TO_POINTER(1));
+ gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, gtalk_name, 2, "prpl-jabber", -1); @@ -721,14 +676,11 @@
if (facebook_name && strcmp(facebook_name, plugin->info->name) < 0) {
char *filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols",
"16", "facebook.png", NULL);
pixbuf = pidgin_pixbuf_new_from_file(filename);
- gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
- item = aop_menu_item_new(sg, pixbuf, facebook_name, "prpl-jabber", "protocol"));
- g_object_set_data(G_OBJECT(item), "fakefacebook", GINT_TO_POINTER(1));
+ gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, facebook_name, 2, "prpl-jabber", -1); @@ -739,8 +691,8 @@
pixbuf = pidgin_create_prpl_icon_from_prpl(plugin, PIDGIN_PRPL_ICON_SMALL, NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
- aop_menu_item_new(sg, pixbuf, plugin->info->name, plugin->info->id, "protocol"));
+ gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, plugin->info->name, 2, plugin->info->id, -1); @@ -748,9 +700,6 @@
if (default_proto_id != NULL && !strcmp(plugin->info->id, default_proto_id))
aop_menu->default_item = i;
@@ -764,13 +713,13 @@
pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu)
- return (const char *)aop_option_menu_get_selected(optmenu, NULL);
+ return (const char *)aop_option_menu_get_selected(optmenu); pidgin_account_option_menu_get_selected(GtkWidget *optmenu)
- return (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL);
+ return (PurpleAccount *)aop_option_menu_get_selected(optmenu); @@ -782,7 +731,8 @@
GdkPixbuf *pixbuf = NULL;
@@ -791,11 +741,11 @@
list = purple_connections_get_all();
+ ls = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER); aop_menu = g_malloc0(sizeof(AopMenu));
aop_menu->default_item = -1;
- aop_menu->menu = gtk_menu_new();
- gtk_widget_show(aop_menu->menu);
- sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ aop_menu->model = GTK_TREE_MODEL(ls); for (p = list, i = 0; p != NULL; p = p->next, i++) {
@@ -830,8 +780,8 @@
purple_account_get_protocol_name(account));
- gtk_menu_shell_append(GTK_MENU_SHELL(aop_menu->menu),
- aop_menu_item_new(sg, pixbuf, buf, account, "account"));
+ gtk_list_store_append(ls, &iter); + gtk_list_store_set(ls, &iter, 0, pixbuf, 1, buf, 2, account, -1); @@ -839,9 +789,6 @@
if (default_account && account == default_account)
aop_menu->default_item = i;
@@ -852,7 +799,7 @@
PurpleFilterAccountFunc filter_func;
- account = (PurpleAccount *)aop_option_menu_get_selected(optmenu, NULL);
+ account = (PurpleAccount *)aop_option_menu_get_selected(optmenu); show_all = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(optmenu), "show_all"));
filter_func = g_object_get_data(G_OBJECT(optmenu), "filter_func");
@@ -920,8 +867,6 @@
g_object_set_data(G_OBJECT(optmenu), "filter_func", filter_func);
pidgin_setup_gtkspell(GtkTextView *textview)
@@ -1276,8 +1221,8 @@
widget = GTK_WIDGET(menu);
screen = gtk_widget_get_screen(widget);
- xthickness = widget->style->xthickness;
- ythickness = widget->style->ythickness;
+ xthickness = gtk_widget_get_style(widget)->xthickness; + ythickness = gtk_widget_get_style(widget)->ythickness; rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
@@ -1415,9 +1360,9 @@
- gint ythickness = GTK_WIDGET(menu)->style->ythickness;
- gdk_window_get_origin (widget->window, x, y);
+ gint ythickness = gtk_widget_get_style(GTK_WIDGET(menu))->ythickness; + gdk_window_get_origin (gtk_widget_get_window(widget), x, y); gtk_tree_view_get_cursor (tv, &path, &col);
gtk_tree_view_get_cell_area (tv, path, col, &rect);
@@ -1534,7 +1479,7 @@
pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who)
- GList *files = purple_uri_list_extract_filenames((const gchar *)sd->data);
+ GList *files = purple_uri_list_extract_filenames((const gchar *) gtk_selection_data_get_data(sd)); PurpleConnection *gc = purple_account_get_connection(account);
PurplePluginProtocolInfo *prpl_info = NULL;
@@ -1852,7 +1797,9 @@
group = gtk_menu_get_accel_group(GTK_MENU(menu));
- char *path = g_strdup_printf("%s/%s", GTK_MENU_ITEM(menuitem)->accel_path, act->label);
+ char *path = g_strdup_printf("%s/%s", + gtk_menu_item_get_accel_path(GTK_MENU_ITEM(menuitem)), gtk_menu_set_accel_path(GTK_MENU(submenu), path);
gtk_menu_set_accel_group(GTK_MENU(submenu), group);
@@ -2168,23 +2115,23 @@
g_return_if_fail(widget != NULL);
- if (widget->window == NULL)
+ if (gtk_widget_get_window(widget) == NULL) cursor = gdk_cursor_new(cursor_type);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor); gdk_cursor_unref(cursor);
- gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window)));
+ gdk_display_flush(gdk_window_get_display(gtk_widget_get_window(widget))); void pidgin_clear_cursor(GtkWidget *widget)
g_return_if_fail(widget != NULL);
- if (widget->window == NULL)
+ if (gtk_widget_get_window(widget) == NULL) - gdk_window_set_cursor(widget->window, NULL);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), NULL); @@ -2225,7 +2172,7 @@
gtk_widget_destroy(dialog->icon_filesel);
@@ -2844,7 +2791,7 @@
- style = gtk_widget_get_style(widget);
+ style = gtk_widget_get_style(widget); @@ -2856,18 +2803,18 @@
-combo_box_changed_cb(GtkComboBox *combo_box, GtkEntry *entry)
+combo_box_changed_cb(GtkComboBoxText *combo_box, GtkEntry *entry) - char *text = gtk_combo_box_get_active_text(combo_box);
+ char *text = gtk_combo_box_text_get_active_text(combo_box); gtk_entry_set_text(entry, text ? text : "");
-entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBox *combo)
+entry_key_pressed_cb(GtkWidget *entry, GdkEventKey *key, GtkComboBoxText *combo) - if (key->keyval == GDK_Down || key->keyval == GDK_Up) {
- gtk_combo_box_popup(combo);
+ if (key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_Up) { + gtk_combo_box_popup(GTK_COMBO_BOX(combo)); @@ -2876,10 +2823,10 @@
pidgin_text_combo_box_entry_new(const char *default_item, GList *items)
- GtkComboBox *ret = NULL;
+ GtkComboBoxText *ret = NULL; GtkWidget *the_entry = NULL;
- ret = GTK_COMBO_BOX(gtk_combo_box_entry_new_text());
+ ret = GTK_COMBO_BOX_TEXT(gtk_combo_box_text_new_with_entry()); the_entry = gtk_entry_new();
gtk_container_add(GTK_CONTAINER(ret), the_entry);
@@ -2889,7 +2836,7 @@
for (; items != NULL ; items = items->next) {
char *text = items->data;
- gtk_combo_box_append_text(ret, text);
+ gtk_combo_box_text_append_text(ret, text); g_signal_connect(G_OBJECT(ret), "changed", (GCallback)combo_box_changed_cb, the_entry);
@@ -2900,12 +2847,12 @@
const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget)
- return gtk_entry_get_text(GTK_ENTRY(GTK_BIN((widget))->child));
+ return gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget))))); void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text)
- gtk_entry_set_text(GTK_ENTRY(GTK_BIN((widget))->child), (text));
+ gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((widget)))), (text)); @@ -3026,12 +2973,12 @@
windows = g_list_delete_link(windows, windows);
- !GTK_WIDGET_VISIBLE(window)) {
+ !gtk_widget_get_visible(window)) { if (gtk_window_has_toplevel_focus(GTK_WINDOW(window)) ||
- (menu && menu == window->window)) {
+ (menu && menu == gtk_widget_get_window(window))) { @@ -3592,7 +3539,7 @@
if (width != -1 || height != -1)
gtk_widget_set_size_request(sw, width, height);
- if (GTK_WIDGET_GET_CLASS(child)->set_scroll_adjustments_signal)
+ if (GTK_IS_SCROLLABLE(child)) gtk_container_add(GTK_CONTAINER(sw), child);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), child);