Mercurial > pidgin.yaz
comparison gtk/gtkblist.c @ 15199:c9bb2131bdf3
[gaim-migrate @ 17988]
Fix for glib < 2.10.0
I'm a little confused about the final g_object_unref() - it seems like that might would the ref-count zero (I don't see anywhere where "tooltips" is being referenced).
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 13 Dec 2006 21:29:16 +0000 |
parents | 933ae49622e7 |
children | 152756b02fca |
comparison
equal
deleted
inserted
replaced
15198:933ae49622e7 | 15199:c9bb2131bdf3 |
---|---|
2740 gaim_notify_user_info_add_pair(user_info, _("Description"), _("Spooky")); | 2740 gaim_notify_user_info_add_pair(user_info, _("Description"), _("Spooky")); |
2741 if (!g_ascii_strcasecmp(b->name, "seanegn")) | 2741 if (!g_ascii_strcasecmp(b->name, "seanegn")) |
2742 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Awesome")); | 2742 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Awesome")); |
2743 if (!g_ascii_strcasecmp(b->name, "chipx86")) | 2743 if (!g_ascii_strcasecmp(b->name, "chipx86")) |
2744 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'")); | 2744 gaim_notify_user_info_add_pair(user_info, _("Status"), _("Rockin'")); |
2745 | 2745 |
2746 tmp = gaim_notify_user_info_get_text_with_newline(user_info, "\n"); | 2746 tmp = gaim_notify_user_info_get_text_with_newline(user_info, "\n"); |
2747 g_string_append(str, tmp); | 2747 g_string_append(str, tmp); |
2748 g_free(tmp); | 2748 g_free(tmp); |
2749 | 2749 |
2750 gaim_notify_user_info_destroy(user_info); | 2750 gaim_notify_user_info_destroy(user_info); |
3823 static gboolean | 3823 static gboolean |
3824 paint_headline_hbox (GtkWidget *widget, | 3824 paint_headline_hbox (GtkWidget *widget, |
3825 GdkEventExpose *event, | 3825 GdkEventExpose *event, |
3826 gpointer user_data) | 3826 gpointer user_data) |
3827 { | 3827 { |
3828 gtk_paint_flat_box (widget->style, | 3828 gtk_paint_flat_box (widget->style, |
3829 widget->window, | 3829 widget->window, |
3830 GTK_STATE_NORMAL, | 3830 GTK_STATE_NORMAL, |
3831 GTK_SHADOW_OUT, | 3831 GTK_SHADOW_OUT, |
3832 NULL, | 3832 NULL, |
3833 widget, | 3833 widget, |
3834 "tooltip", | 3834 "tooltip", |
3835 widget->allocation.x + 1, | 3835 widget->allocation.x + 1, |
3836 widget->allocation.y + 1, | 3836 widget->allocation.y + 1, |
3837 widget->allocation.width - 2, | 3837 widget->allocation.width - 2, |
3838 widget->allocation.height - 2); | 3838 widget->allocation.height - 2); |
3839 | 3839 |
3840 return FALSE; | 3840 return FALSE; |
3841 } | 3841 } |
3842 | 3842 |
3843 static void | 3843 static void |
3844 headline_style_set (GtkWidget *widget, | 3844 headline_style_set (GtkWidget *widget, |
3845 GtkStyle *prev_style) | 3845 GtkStyle *prev_style) |
3846 { | 3846 { |
3847 GtkTooltips *tooltips; | 3847 GtkTooltips *tooltips; |
3848 GtkStyle *style; | 3848 GtkStyle *style; |
3849 | 3849 |
3850 if (gtkblist->changing_style) | 3850 if (gtkblist->changing_style) |
3851 return; | 3851 return; |
3852 | 3852 |
3853 tooltips = gtk_tooltips_new (); | 3853 tooltips = gtk_tooltips_new (); |
3854 #if GLIB_CHECK_VERSION(2,10,0) | |
3854 g_object_ref_sink (tooltips); | 3855 g_object_ref_sink (tooltips); |
3856 #else | |
3857 g_object_ref(tooltips); | |
3858 gtk_object_sink(GTK_OBJECT(tooltips)); | |
3859 #endif | |
3855 | 3860 |
3856 gtk_tooltips_force_window (tooltips); | 3861 gtk_tooltips_force_window (tooltips); |
3857 gtk_widget_ensure_style (tooltips->tip_window); | 3862 gtk_widget_ensure_style (tooltips->tip_window); |
3858 style = gtk_widget_get_style (tooltips->tip_window); | 3863 style = gtk_widget_get_style (tooltips->tip_window); |
3859 | 3864 |
3860 gtkblist->changing_style = TRUE; | 3865 gtkblist->changing_style = TRUE; |
3861 gtk_widget_set_style (gtkblist->headline_hbox, style); | 3866 gtk_widget_set_style (gtkblist->headline_hbox, style); |
3862 gtkblist->changing_style = FALSE; | 3867 gtkblist->changing_style = FALSE; |
3863 | 3868 |
3864 g_object_unref (tooltips); | 3869 g_object_unref (tooltips); |
3865 } | 3870 } |
3866 | 3871 |
3867 /******************************************/ | 3872 /******************************************/ |
3868 /* End of connection error handling stuff */ | 3873 /* End of connection error handling stuff */ |
3902 bbox = gtk_hbutton_box_new(); | 3907 bbox = gtk_hbutton_box_new(); |
3903 button = gtk_button_new_with_mnemonic(_("_Login")); | 3908 button = gtk_button_new_with_mnemonic(_("_Login")); |
3904 gtk_box_pack_start(GTK_BOX(ret), bbox, FALSE, FALSE, 0); | 3909 gtk_box_pack_start(GTK_BOX(ret), bbox, FALSE, FALSE, 0); |
3905 gtk_container_add(GTK_CONTAINER(bbox), button); | 3910 gtk_container_add(GTK_CONTAINER(bbox), button); |
3906 | 3911 |
3907 | 3912 |
3908 label = gtk_label_new(NULL); | 3913 label = gtk_label_new(NULL); |
3909 gtk_box_pack_start(GTK_BOX(ret), label, TRUE, TRUE, 0); | 3914 gtk_box_pack_start(GTK_BOX(ret), label, TRUE, TRUE, 0); |
3910 | 3915 |
3911 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER); | 3916 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER); |
3912 | 3917 |
3993 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook), kiosk_page(), NULL); | 3998 gtk_notebook_append_page(GTK_NOTEBOOK(gtkblist->notebook), kiosk_page(), NULL); |
3994 #endif | 3999 #endif |
3995 | 4000 |
3996 /* Translators: Please maintain the use of -> and <- to refer to menu heirarchy */ | 4001 /* Translators: Please maintain the use of -> and <- to refer to menu heirarchy */ |
3997 pretty = gaim_gtk_make_pretty_arrows(_("<span weight='bold' size='larger'>Welcome to Gaim!</span>\n\n" | 4002 pretty = gaim_gtk_make_pretty_arrows(_("<span weight='bold' size='larger'>Welcome to Gaim!</span>\n\n" |
3998 | 4003 |
3999 "You have no accounts enabled. Enable your IM accounts from the " | 4004 "You have no accounts enabled. Enable your IM accounts from the " |
4000 "<b>Accounts</b> window at <b>Accounts->Add/Edit</b>. Once you " | 4005 "<b>Accounts</b> window at <b>Accounts->Add/Edit</b>. Once you " |
4001 "enable accounts, you'll be able to sign on, set your status, " | 4006 "enable accounts, you'll be able to sign on, set your status, " |
4002 "and talk to your friends.")); | 4007 "and talk to your friends.")); |
4003 label = gtk_label_new(NULL); | 4008 label = gtk_label_new(NULL); |
4041 gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); | 4046 gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); |
4042 gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); | 4047 gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); |
4043 g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), gtkblist); | 4048 g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), gtkblist); |
4044 g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), gtkblist); | 4049 g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), gtkblist); |
4045 g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist); | 4050 g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist); |
4046 | 4051 |
4047 /****************************** GtkTreeView **********************************/ | 4052 /****************************** GtkTreeView **********************************/ |
4048 sw = gtk_scrolled_window_new(NULL,NULL); | 4053 sw = gtk_scrolled_window_new(NULL,NULL); |
4049 gtk_widget_show(sw); | 4054 gtk_widget_show(sw); |
4050 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | 4055 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); |
4051 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 4056 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
4052 | 4057 |
4053 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, | 4058 gtkblist->treemodel = gtk_tree_store_new(BLIST_COLUMNS, |
4054 GDK_TYPE_PIXBUF, /* Status icon */ | 4059 GDK_TYPE_PIXBUF, /* Status icon */ |
4055 G_TYPE_BOOLEAN, /* Status icon visible */ | 4060 G_TYPE_BOOLEAN, /* Status icon visible */ |
4056 G_TYPE_STRING, /* Name */ | 4061 G_TYPE_STRING, /* Name */ |
4057 G_TYPE_STRING, /* Idle */ | 4062 G_TYPE_STRING, /* Idle */ |
4058 G_TYPE_BOOLEAN, /* Idle visible */ | 4063 G_TYPE_BOOLEAN, /* Idle visible */ |
4059 GDK_TYPE_PIXBUF, /* Buddy icon */ | 4064 GDK_TYPE_PIXBUF, /* Buddy icon */ |
4060 G_TYPE_BOOLEAN, /* Buddy icon visible */ | 4065 G_TYPE_BOOLEAN, /* Buddy icon visible */ |
4061 G_TYPE_POINTER, /* Node */ | 4066 G_TYPE_POINTER, /* Node */ |
4093 /* Tooltips */ | 4098 /* Tooltips */ |
4094 g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(gaim_gtk_blist_motion_cb), NULL); | 4099 g_signal_connect(G_OBJECT(gtkblist->treeview), "motion-notify-event", G_CALLBACK(gaim_gtk_blist_motion_cb), NULL); |
4095 g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(gaim_gtk_blist_leave_cb), NULL); | 4100 g_signal_connect(G_OBJECT(gtkblist->treeview), "leave-notify-event", G_CALLBACK(gaim_gtk_blist_leave_cb), NULL); |
4096 | 4101 |
4097 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE); | 4102 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE); |
4098 | 4103 |
4099 column = gtk_tree_view_column_new(); | 4104 column = gtk_tree_view_column_new(); |
4100 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 4105 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
4101 gtk_tree_view_column_set_visible(column, FALSE); | 4106 gtk_tree_view_column_set_visible(column, FALSE); |
4102 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 4107 gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
4103 | 4108 |
4150 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); | 4155 gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column); |
4151 | 4156 |
4152 rend = gtk_cell_renderer_text_new(); | 4157 rend = gtk_cell_renderer_text_new(); |
4153 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL); | 4158 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL); |
4154 gtk_tree_view_column_pack_start(column, rend, FALSE); | 4159 gtk_tree_view_column_pack_start(column, rend, FALSE); |
4155 gtk_tree_view_column_set_attributes(column, rend, | 4160 gtk_tree_view_column_set_attributes(column, rend, |
4156 "markup", IDLE_COLUMN, | 4161 "markup", IDLE_COLUMN, |
4157 "visible", IDLE_VISIBLE_COLUMN, | 4162 "visible", IDLE_VISIBLE_COLUMN, |
4158 #if GTK_CHECK_VERSION(2,6,0) | 4163 #if GTK_CHECK_VERSION(2,6,0) |
4159 "cell-background-gdk", BGCOLOR_COLUMN, | 4164 "cell-background-gdk", BGCOLOR_COLUMN, |
4160 #endif | 4165 #endif |
4161 NULL); | 4166 NULL); |
4162 | 4167 |
4163 rend = gtk_cell_renderer_pixbuf_new(); | 4168 rend = gtk_cell_renderer_pixbuf_new(); |
4164 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL); | 4169 g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL); |
4165 gtk_tree_view_column_pack_start(column, rend, FALSE); | 4170 gtk_tree_view_column_pack_start(column, rend, FALSE); |
4166 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", BUDDY_ICON_COLUMN, | 4171 gtk_tree_view_column_set_attributes(column, rend, "pixbuf", BUDDY_ICON_COLUMN, |
4167 #if GTK_CHECK_VERSION(2,6,0) | 4172 #if GTK_CHECK_VERSION(2,6,0) |
4168 "cell-background-gdk", BGCOLOR_COLUMN, | 4173 "cell-background-gdk", BGCOLOR_COLUMN, |
4169 #endif | 4174 #endif |
4170 "visible", BUDDY_ICON_VISIBLE_COLUMN, | 4175 "visible", BUDDY_ICON_VISIBLE_COLUMN, |
4171 NULL); | 4176 NULL); |
4172 | 4177 |
4173 | 4178 |
4174 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); | 4179 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-activated", G_CALLBACK(gtk_blist_row_activated_cb), NULL); |
4175 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL); | 4180 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-expanded", G_CALLBACK(gtk_blist_row_expanded_cb), NULL); |
4176 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL); | 4181 g_signal_connect(G_OBJECT(gtkblist->treeview), "row-collapsed", G_CALLBACK(gtk_blist_row_collapsed_cb), NULL); |
4177 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); | 4182 g_signal_connect(G_OBJECT(gtkblist->treeview), "button-press-event", G_CALLBACK(gtk_blist_button_press_cb), NULL); |
4188 sep = gtk_hseparator_new(); | 4193 sep = gtk_hseparator_new(); |
4189 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sep, FALSE, FALSE, 0); | 4194 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sep, FALSE, FALSE, 0); |
4190 | 4195 |
4191 gtkblist->scrollbook = gtk_gaim_scroll_book_new(); | 4196 gtkblist->scrollbook = gtk_gaim_scroll_book_new(); |
4192 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0); | 4197 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0); |
4193 | 4198 |
4194 /* Create an empty vbox used for showing connection errors */ | 4199 /* Create an empty vbox used for showing connection errors */ |
4195 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0); | 4200 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0); |
4196 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); | 4201 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); |
4197 | 4202 |
4198 /* Add the statusbox */ | 4203 /* Add the statusbox */ |
4290 gtkblist, GAIM_CALLBACK(conversation_deleting_cb), | 4295 gtkblist, GAIM_CALLBACK(conversation_deleting_cb), |
4291 gtkblist); | 4296 gtkblist); |
4292 | 4297 |
4293 // gtk_widget_hide(gtkblist->scrollbook); | 4298 // gtk_widget_hide(gtkblist->scrollbook); |
4294 gtk_widget_hide(gtkblist->headline_hbox); | 4299 gtk_widget_hide(gtkblist->headline_hbox); |
4295 | 4300 |
4296 /* emit our created signal */ | 4301 /* emit our created signal */ |
4297 gaim_signal_emit(handle, "gtkblist-created", list); | 4302 gaim_signal_emit(handle, "gtkblist-created", list); |
4298 } | 4303 } |
4299 | 4304 |
4300 static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender) | 4305 static void redo_buddy_list(GaimBuddyList *list, gboolean remove, gboolean rerender) |
4532 GtkTreeIter iter; | 4537 GtkTreeIter iter; |
4533 GtkTreePath *path; | 4538 GtkTreePath *path; |
4534 gboolean expanded; | 4539 gboolean expanded; |
4535 GdkColor bgcolor; | 4540 GdkColor bgcolor; |
4536 GdkColor textcolor; | 4541 GdkColor textcolor; |
4537 | 4542 |
4538 if(!insert_node(list, gnode, &iter)) | 4543 if(!insert_node(list, gnode, &iter)) |
4539 return; | 4544 return; |
4540 | 4545 |
4541 bgcolor = gtkblist->treeview->style->bg[GTK_STATE_ACTIVE]; | 4546 bgcolor = gtkblist->treeview->style->bg[GTK_STATE_ACTIVE]; |
4542 textcolor = gtkblist->treeview->style->fg[GTK_STATE_ACTIVE]; | 4547 textcolor = gtkblist->treeview->style->fg[GTK_STATE_ACTIVE]; |
4558 mark = g_strdup_printf("<span color='#%02x%02x%02x' weight='bold'>%s</span>%s", | 4563 mark = g_strdup_printf("<span color='#%02x%02x%02x' weight='bold'>%s</span>%s", |
4559 textcolor.red>>8, textcolor.green>>8, textcolor.blue>>8, | 4564 textcolor.red>>8, textcolor.green>>8, textcolor.blue>>8, |
4560 esc, group_count); | 4565 esc, group_count); |
4561 | 4566 |
4562 g_free(esc); | 4567 g_free(esc); |
4563 | 4568 |
4564 gtk_tree_store_set(gtkblist->treemodel, &iter, | 4569 gtk_tree_store_set(gtkblist->treemodel, &iter, |
4565 STATUS_ICON_VISIBLE_COLUMN, FALSE, | 4570 STATUS_ICON_VISIBLE_COLUMN, FALSE, |
4566 STATUS_ICON_COLUMN, NULL, | 4571 STATUS_ICON_COLUMN, NULL, |
4567 NAME_COLUMN, mark, | 4572 NAME_COLUMN, mark, |
4568 NODE_COLUMN, gnode, | 4573 NODE_COLUMN, gnode, |
4847 gtkblist->treemodel = NULL; | 4852 gtkblist->treemodel = NULL; |
4848 g_object_unref(G_OBJECT(gtkblist->ift)); | 4853 g_object_unref(G_OBJECT(gtkblist->ift)); |
4849 g_free(gtkblist); | 4854 g_free(gtkblist); |
4850 accountmenu = NULL; | 4855 accountmenu = NULL; |
4851 gtkblist = NULL; | 4856 gtkblist = NULL; |
4852 | 4857 |
4853 gdk_cursor_unref(gtkblist->hand_cursor); | 4858 gdk_cursor_unref(gtkblist->hand_cursor); |
4854 gdk_cursor_unref(gtkblist->arrow_cursor); | 4859 gdk_cursor_unref(gtkblist->arrow_cursor); |
4855 gtkblist->hand_cursor = NULL; | 4860 gtkblist->hand_cursor = NULL; |
4856 gtkblist->arrow_cursor = NULL; | 4861 gtkblist->arrow_cursor = NULL; |
4857 | 4862 |
5525 void | 5530 void |
5526 gaim_gtk_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data) | 5531 gaim_gtk_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data) |
5527 { | 5532 { |
5528 gtk_label_set_markup(GTK_LABEL(gtkblist->headline_label), text); | 5533 gtk_label_set_markup(GTK_LABEL(gtkblist->headline_label), text); |
5529 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkblist->headline_image), pixbuf); | 5534 gtk_image_set_from_pixbuf(GTK_IMAGE(gtkblist->headline_image), pixbuf); |
5530 | 5535 |
5531 gtkblist->headline_callback = callback; | 5536 gtkblist->headline_callback = callback; |
5532 gtkblist->headline_data = user_data; | 5537 gtkblist->headline_data = user_data; |
5533 gtk_widget_show_all(gtkblist->headline_hbox); | 5538 gtk_widget_show_all(gtkblist->headline_hbox); |
5534 } | 5539 } |
5535 | 5540 |