Mercurial > pidgin.yaz
comparison gtk/gtkblist.c @ 15182:fbe2187bceec
[gaim-migrate @ 17968]
incomplete. Working on this from home. You may see where it's going.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Tue, 12 Dec 2006 04:45:02 +0000 |
parents | 99e636fd0a47 |
children | a505577b6f4b |
comparison
equal
deleted
inserted
replaced
15181:4b500bd49d38 | 15182:fbe2187bceec |
---|---|
3669 if (GTK_IS_IMHTML(imhtml) && gtk_bindings_activate(GTK_OBJECT(imhtml), event->keyval, event->state)) | 3669 if (GTK_IS_IMHTML(imhtml) && gtk_bindings_activate(GTK_OBJECT(imhtml), event->keyval, event->state)) |
3670 return TRUE; | 3670 return TRUE; |
3671 return FALSE; | 3671 return FALSE; |
3672 } | 3672 } |
3673 | 3673 |
3674 static gboolean | |
3675 headline_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, GaimGtkBuddyList *gtkblist) | |
3676 { | |
3677 gdk_window_set_cursor(widget->window, gtkblist->hand_cursor); | |
3678 return FALSE; | |
3679 } | |
3680 | |
3681 static gboolean | |
3682 headline_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, GaimGtkBuddyList *gtkblist) | |
3683 { | |
3684 gdk_window_set_cursor(widget->window, gtkblist->arrow_cursor); | |
3685 return FALSE; | |
3686 } | |
3687 | |
3688 static gboolean | |
3689 headline_box_press_cb(GtkWidget *widget, GdkEventButton *event, GaimGtkBuddyList *box) | |
3690 { | |
3691 gtk_widget_hide(gtkblist->headline_hbox); | |
3692 } | |
3693 | |
3674 /***********************************/ | 3694 /***********************************/ |
3675 /* Connection error handling stuff */ | 3695 /* Connection error handling stuff */ |
3676 /***********************************/ | 3696 /***********************************/ |
3677 | 3697 |
3678 static void | 3698 static void |
3788 /* Add new error buttons */ | 3808 /* Add new error buttons */ |
3789 g_hash_table_foreach(gtkblist->connection_errors, | 3809 g_hash_table_foreach(gtkblist->connection_errors, |
3790 create_connection_error_buttons, NULL); | 3810 create_connection_error_buttons, NULL); |
3791 } | 3811 } |
3792 | 3812 |
3813 static gboolean | |
3814 paint_headline_hbox (GtkWidget *widget, | |
3815 GdkEventExpose *event, | |
3816 gpointer user_data) | |
3817 { | |
3818 gtk_paint_flat_box (widget->style, | |
3819 widget->window, | |
3820 GTK_STATE_NORMAL, | |
3821 GTK_SHADOW_OUT, | |
3822 NULL, | |
3823 widget, | |
3824 "tooltip", | |
3825 widget->allocation.x + 1, | |
3826 widget->allocation.y + 1, | |
3827 widget->allocation.width - 2, | |
3828 widget->allocation.height - 2); | |
3829 | |
3830 return FALSE; | |
3831 } | |
3832 | |
3793 | 3833 |
3794 /******************************************/ | 3834 /******************************************/ |
3795 /* End of connection error handling stuff */ | 3835 /* End of connection error handling stuff */ |
3796 /******************************************/ | 3836 /******************************************/ |
3797 | 3837 |
3846 { | 3886 { |
3847 void *handle; | 3887 void *handle; |
3848 GtkCellRenderer *rend; | 3888 GtkCellRenderer *rend; |
3849 GtkTreeViewColumn *column; | 3889 GtkTreeViewColumn *column; |
3850 GtkWidget *menu; | 3890 GtkWidget *menu; |
3891 GtkWidget *ebox; | |
3851 GtkWidget *sw; | 3892 GtkWidget *sw; |
3852 GtkWidget *sep; | 3893 GtkWidget *sep; |
3853 GtkWidget *label; | 3894 GtkWidget *label; |
3854 GList *accounts; | 3895 GList *accounts; |
3855 char *pretty; | 3896 char *pretty; |
3939 if ((accounts = gaim_accounts_get_all_active())) { | 3980 if ((accounts = gaim_accounts_get_all_active())) { |
3940 g_list_free(accounts); | 3981 g_list_free(accounts); |
3941 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 1); | 3982 gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkblist->notebook), 1); |
3942 } | 3983 } |
3943 | 3984 |
3985 ebox = gtk_event_box_new(); | |
3986 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), ebox, FALSE, FALSE, 0); | |
3987 gtkblist->headline_hbox = gtk_hbox_new(FALSE, 3); | |
3988 gtk_container_set_border_width(GTK_CONTAINER(gtkblist->headline_hbox), 6); | |
3989 gtk_container_add(GTK_CONTAINER(ebox), gtkblist->headline_hbox); | |
3990 gtkblist->headline_image = gtk_image_new_from_pixbuf(NULL); | |
3991 gtkblist->headline_label = gtk_label_new(NULL); | |
3992 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_image, FALSE, FALSE, 0); | |
3993 gtk_box_pack_start(GTK_BOX(gtkblist->headline_hbox), gtkblist->headline_label, TRUE, TRUE, 0); | |
3994 g_signal_connect (gtkblist->headline_hbox, | |
3995 "expose_event", | |
3996 G_CALLBACK (paint_headline_hbox), | |
3997 NULL); | |
3998 gtkblist->hand_cursor = gdk_cursor_new (GDK_HAND2); | |
3999 gtkblist->arrow_cursor = gdk_cursor_new (GDK_LEFT_PTR); | |
4000 g_signal_connect(G_OBJECT(ebox), "enter-notify-event", G_CALLBACK(headline_box_enter_cb), gtkblist); | |
4001 g_signal_connect(G_OBJECT(ebox), "leave-notify-event", G_CALLBACK(headline_box_leave_cb), gtkblist); | |
4002 g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(headline_box_press_cb), gtkblist); | |
4003 | |
3944 /****************************** GtkTreeView **********************************/ | 4004 /****************************** GtkTreeView **********************************/ |
3945 sw = gtk_scrolled_window_new(NULL,NULL); | 4005 sw = gtk_scrolled_window_new(NULL,NULL); |
3946 gtk_widget_show(sw); | 4006 gtk_widget_show(sw); |
3947 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | 4007 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); |
3948 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | 4008 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
4080 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview), gaim_gtk_tree_view_search_equal_func, NULL, NULL); | 4140 gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(gtkblist->treeview), gaim_gtk_tree_view_search_equal_func, NULL, NULL); |
4081 | 4141 |
4082 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); | 4142 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sw, TRUE, TRUE, 0); |
4083 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); | 4143 gtk_container_add(GTK_CONTAINER(sw), gtkblist->treeview); |
4084 | 4144 |
4145 sep = gtk_hseparator_new(); | |
4146 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sep, FALSE, FALSE, 0); | |
4147 | |
4085 gtkblist->scrollbook = gtk_gaim_scroll_book_new(); | 4148 gtkblist->scrollbook = gtk_gaim_scroll_book_new(); |
4086 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0); | 4149 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->scrollbook, FALSE, FALSE, 0); |
4087 | |
4088 sep = gtk_hseparator_new(); | |
4089 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), sep, FALSE, FALSE, 0); | |
4090 | 4150 |
4091 /* Create an empty vbox used for showing connection errors */ | 4151 /* Create an empty vbox used for showing connection errors */ |
4092 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0); | 4152 gtkblist->error_buttons = gtk_vbox_new(FALSE, 0); |
4093 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); | 4153 gtk_box_pack_start(GTK_BOX(gtkblist->vbox), gtkblist->error_buttons, FALSE, FALSE, 0); |
4094 | 4154 |
4743 gtkblist->treemodel = NULL; | 4803 gtkblist->treemodel = NULL; |
4744 g_object_unref(G_OBJECT(gtkblist->ift)); | 4804 g_object_unref(G_OBJECT(gtkblist->ift)); |
4745 g_free(gtkblist); | 4805 g_free(gtkblist); |
4746 accountmenu = NULL; | 4806 accountmenu = NULL; |
4747 gtkblist = NULL; | 4807 gtkblist = NULL; |
4808 | |
4809 gdk_cursor_unref(gtkblist->hand_cursor); | |
4810 gdk_cursor_unref(gtkblist->arrow_cursor); | |
4811 gtkblist->hand_cursor = NULL; | |
4812 gtkblist->arrow_cursor = NULL; | |
4748 | 4813 |
4749 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle()); | 4814 gaim_prefs_disconnect_by_handle(gaim_gtk_blist_get_handle()); |
4750 } | 4815 } |
4751 | 4816 |
4752 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show) | 4817 static void gaim_gtk_blist_set_visible(GaimBuddyList *list, gboolean show) |
5411 void gaim_gtk_blist_add_alert(GtkWidget *widget) | 5476 void gaim_gtk_blist_add_alert(GtkWidget *widget) |
5412 { | 5477 { |
5413 gtk_container_add(GTK_CONTAINER(gtkblist->scrollbook), widget); | 5478 gtk_container_add(GTK_CONTAINER(gtkblist->scrollbook), widget); |
5414 } | 5479 } |
5415 | 5480 |
5481 void | |
5482 gaim_gtk_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data) | |
5483 { | |
5484 gtk_label_set_markup(gtkblist->headline_label, text); | |
5485 gtk_image_set_from_pixbuf(gtkblist->headline_image, pixbuf); | |
5486 | |
5487 gtkblist->headline_callback = callback; | |
5488 gtkblist->headline_data = user_data; | |
5489 gtk_widget_show_all(gtkblist->headline_hbox); | |
5490 } | |
5416 | 5491 |
5417 static GaimBlistUiOps blist_ui_ops = | 5492 static GaimBlistUiOps blist_ui_ops = |
5418 { | 5493 { |
5419 gaim_gtk_blist_new_list, | 5494 gaim_gtk_blist_new_list, |
5420 gaim_gtk_blist_new_node, | 5495 gaim_gtk_blist_new_node, |