# HG changeset patch # User Daniel Atallah # Date 1131929220 0 # Node ID 950acb2bc83589290e71940a99b003de24467502 # Parent c59115994f6771a3ec0181a0b5d96e02e54c102c [gaim-migrate @ 14370] Patch from sadrul to allow you to show/hide the status message entry field by clicking on the box. committer: Tailor Script diff -r c59115994f67 -r 950acb2bc835 src/gtkstatusbox.c --- a/src/gtkstatusbox.c Sun Nov 13 22:16:54 2005 +0000 +++ b/src/gtkstatusbox.c Mon Nov 14 00:47:00 2005 +0000 @@ -191,7 +191,6 @@ } } - static void gtk_gaim_status_box_class_init (GtkGaimStatusBoxClass *klass) { @@ -416,13 +415,15 @@ } message = gaim_savedstatus_get_message(saved_status); - if (message == NULL) + if (!message || !*message) { status_box->imhtml_visible = FALSE; + gtk_widget_hide_all(status_box->vbox); } else { status_box->imhtml_visible = TRUE; + gtk_widget_show_all(status_box->vbox); /* * Suppress the "changed" signal because the status @@ -517,6 +518,13 @@ update_to_reflect_current_status(data); } +static void status_box_clicked_cb(GtkWidget *w, GdkEventButton *event, GtkGaimStatusBox *box) +{ + if (box->imhtml_visible) + return; + g_signal_emit_by_name(G_OBJECT(box), "changed", NULL, NULL); +} + static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) { @@ -548,7 +556,13 @@ path = gtk_tree_path_new_from_string("0"); gtk_cell_view_set_displayed_row(GTK_CELL_VIEW(status_box->cell_view), path); gtk_tree_path_free(path); - gtk_container_add(GTK_CONTAINER(status_box), status_box->cell_view); + + status_box->event = gtk_event_box_new(); + gtk_widget_show(status_box->event); + g_signal_connect(G_OBJECT(status_box->event), "button_press_event", G_CALLBACK(status_box_clicked_cb), status_box); + gtk_container_add(GTK_CONTAINER(status_box->event), status_box->cell_view); + + gtk_container_add(GTK_CONTAINER(status_box), status_box->event); status_box->icon_rend = gtk_cell_renderer_pixbuf_new(); status_box->text_rend = gtk_cell_renderer_text_new(); @@ -811,6 +825,12 @@ TITLE_COLUMN, &title, -1); message = gtk_gaim_status_box_get_message(status_box); + if (!message || !*message) + { + gtk_widget_hide_all(status_box->vbox); + status_box->imhtml_visible = FALSE; + } + /* * If the currently selected status is "Custom..." or * "Saved..." then do nothing. Custom statuses are @@ -876,7 +896,8 @@ status_box = GTK_GAIM_STATUS_BOX(box); - gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter); + if (!gtk_combo_box_get_active_iter(GTK_COMBO_BOX(status_box), &iter)) + return; gtk_tree_model_get(GTK_TREE_MODEL(status_box->dropdown_store), &iter, TYPE_COLUMN, &type, TITLE_COLUMN, &text, diff -r c59115994f67 -r 950acb2bc835 src/gtkstatusbox.h --- a/src/gtkstatusbox.h Sun Nov 13 22:16:54 2005 +0000 +++ b/src/gtkstatusbox.h Mon Nov 14 00:47:00 2005 +0000 @@ -93,6 +93,7 @@ GtkWidget *vbox, *sw; GtkWidget *imhtml; + GtkWidget *event; gboolean imhtml_visible; GtkWidget *cell_view;