# HG changeset patch # User Mark Doliner # Date 1130042881 0 # Node ID 992d49cf2b929bf3a198c5d9ca2db6dc8ff078e3 # Parent 3959c29f340fefcf15164385cd1c52d88f01011f [gaim-migrate @ 14029] Add a separator in the gtkstatusbox after the standard status types and before Custom... and Saved... I'm fixin' to clean this up a tiny bit committer: Tailor Script diff -r 3959c29f340f -r 992d49cf2b92 src/gtkstatusbox.c --- a/src/gtkstatusbox.c Sun Oct 23 03:57:10 2005 +0000 +++ b/src/gtkstatusbox.c Sun Oct 23 04:48:01 2005 +0000 @@ -49,11 +49,11 @@ static gboolean (*combo_box_expose_event)(GtkWidget *widget, GdkEventExpose *event); static void (*combo_box_forall) (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); enum { - ICON_COLUMN, - TEXT_COLUMN, - TITLE_COLUMN, - DESC_COLUMN, - TYPE_COLUMN, + ICON_COLUMN, /* This is a GdkPixbuf (the other columns are strings) */ + TEXT_COLUMN, /* A string */ + TITLE_COLUMN, /* The plain-English title of this item */ + DESC_COLUMN, /* A plain-English description of this item */ + TYPE_COLUMN, /* A text description of the GaimStatusPrimitive */ NUM_COLUMNS }; @@ -286,6 +286,7 @@ gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf2, _("Away"), NULL, "away"); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf4, _("Invisible"), NULL, "invisible"); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf3, _("Offline"), NULL, "offline"); + gtk_gaim_status_box_add_separator(GTK_GAIM_STATUS_BOX(status_box)); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf, _("Custom..."), NULL, "custom"); gtk_gaim_status_box_add(GTK_GAIM_STATUS_BOX(status_box), pixbuf, _("Saved..."), NULL, "saved"); @@ -346,6 +347,31 @@ } +static gboolean +dropdown_store_row_separator_func(GtkTreeModel *model, + GtkTreeIter *iter, gpointer data) +{ + GdkPixbuf *pixbuf; + gchar *text, *title, *description, *status_type_id; + + gtk_tree_model_get(model, iter, + ICON_COLUMN, &pixbuf, + TEXT_COLUMN, &text, + TITLE_COLUMN, &title, + DESC_COLUMN, &description, + TYPE_COLUMN, &status_type_id, + -1); + + if ((pixbuf == NULL) && (text == NULL) && (title == NULL) && + (description == NULL) && (status_type_id != NULL) && + !strcmp(status_type_id, "separator")) + { + return TRUE; + } + + return FALSE; +} + static void gtk_gaim_status_box_init (GtkGaimStatusBox *status_box) { @@ -390,6 +416,7 @@ status_box->store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); status_box->dropdown_store = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + gtk_combo_box_set_row_separator_func(GTK_COMBO_BOX(status_box), dropdown_store_row_separator_func, NULL, NULL); gtk_combo_box_set_model(GTK_COMBO_BOX(status_box), GTK_TREE_MODEL(status_box->dropdown_store)); gtk_cell_view_set_model(GTK_CELL_VIEW(status_box->cell_view), GTK_TREE_MODEL(status_box->store)); gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(status_box), 0); @@ -538,6 +565,20 @@ } void +gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box) +{ + GtkTreeIter iter; + + gtk_list_store_append(status_box->dropdown_store, &iter); + gtk_list_store_set(status_box->dropdown_store, &iter, + ICON_COLUMN, NULL, + TEXT_COLUMN, NULL, + TITLE_COLUMN, NULL, + DESC_COLUMN, NULL, + TYPE_COLUMN, "separator", -1); +} + +void gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error) { if (status_box->error) diff -r 3959c29f340f -r 992d49cf2b92 src/gtkstatusbox.h --- a/src/gtkstatusbox.h Sun Oct 23 03:57:10 2005 +0000 +++ b/src/gtkstatusbox.h Sun Oct 23 04:48:01 2005 +0000 @@ -111,6 +111,9 @@ gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GdkPixbuf *pixbuf, const char *text, const char *sec_text, const char *edit); void +gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box); + +void gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error); void