comparison src/gtkstatusbox.h @ 11739:a25be0e70a67

[gaim-migrate @ 14030] I changed the GtkStatusBox list stores to use an enum instead of a string to identify the items in the GtkStatusBox. This feels a lot cleaner to me committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 23 Oct 2005 06:46:07 +0000
parents 992d49cf2b92
children 082a2a9aa998
comparison
equal deleted inserted replaced
11738:992d49cf2b92 11739:a25be0e70a67
29 29
30 #include <gtk/gtk.h> 30 #include <gtk/gtk.h>
31 #include "gtkimhtml.h" 31 #include "gtkimhtml.h"
32 #include "account.h" 32 #include "account.h"
33 #include "savedstatuses.h" 33 #include "savedstatuses.h"
34 #include "status.h"
34 #include <gtk/gtktreemodel.h> 35 #include <gtk/gtktreemodel.h>
35 #include <gtk/gtktreeview.h> 36 #include <gtk/gtktreeview.h>
36 #if !GTK_CHECK_VERSION(2,6,0) 37 #if !GTK_CHECK_VERSION(2,6,0)
37 # include "gtkcellview.h" 38 # include "gtkcellview.h"
38 # include "gtkcellviewmenuitem.h" 39 # include "gtkcellviewmenuitem.h"
49 #define GTK_GAIM_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) 50 #define GTK_GAIM_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass))
50 #define GTK_GAIM_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_GAIM_TYPE_STATUS_BOX)) 51 #define GTK_GAIM_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_GAIM_TYPE_STATUS_BOX))
51 #define GTK_GAIM_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_GAIM_TYPE_STATUS_BOX)) 52 #define GTK_GAIM_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_GAIM_TYPE_STATUS_BOX))
52 #define GTK_GAIM_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) 53 #define GTK_GAIM_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass))
53 54
55 /**
56 * This is a hidden field in the GtkStatusBox that identifies the
57 * item in the list store. The item could be a normal
58 * GaimStatusPrimitive, or it could be something special like the
59 * "Custom..." item, or "Saved..." or a GtkSeparator.
60 */
61 typedef enum
62 {
63 /*
64 * The first 0 through GAIM_STATUS_NUM_PRIMITIVES
65 * correspond to GaimStatusPrimitives.
66 */
67 GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR = GAIM_STATUS_NUM_PRIMITIVES,
68 GTK_GAIM_STATUS_BOX_TYPE_CUSTOM,
69 GTK_GAIM_STATUS_BOX_TYPE_SAVED,
70 GTK_GAIM_STATUS_BOX_NUM_TYPES
71 } GtkGaimStatusBoxItemType;
72
54 typedef struct _GtkGaimStatusBox GtkGaimStatusBox; 73 typedef struct _GtkGaimStatusBox GtkGaimStatusBox;
55 typedef struct _GtkGaimStatusBoxClass GtkGaimStatusBoxClass; 74 typedef struct _GtkGaimStatusBoxClass GtkGaimStatusBoxClass;
56 75
57 struct _GtkGaimStatusBox 76 struct _GtkGaimStatusBox
58 { 77 {
59 GtkComboBox parent_instance; 78 GtkComboBox parent_instance;
60 79
80 /**
81 * This GtkListStore contains only one row--the currently selected status.
82 */
61 GtkListStore *store; 83 GtkListStore *store;
84
85 /**
86 * This is the dropdown GtkListStore that contains the available statuses,
87 * plus some recently used statuses, plus the "Custom..." and "Saved..."
88 * options.
89 */
62 GtkListStore *dropdown_store; 90 GtkListStore *dropdown_store;
63 91
64 GaimAccount *account; 92 GaimAccount *account;
65 93
66 GtkWidget *vbox, *sw; 94 GtkWidget *vbox, *sw;
106 GType gtk_gaim_status_box_get_type (void) G_GNUC_CONST; 134 GType gtk_gaim_status_box_get_type (void) G_GNUC_CONST;
107 GtkWidget *gtk_gaim_status_box_new (void); 135 GtkWidget *gtk_gaim_status_box_new (void);
108 GtkWidget *gtk_gaim_status_box_new_with_account (GaimAccount *); 136 GtkWidget *gtk_gaim_status_box_new_with_account (GaimAccount *);
109 137
110 void 138 void
111 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GdkPixbuf *pixbuf, const char *text, const char *sec_text, const char *edit); 139 gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text);
112 140
113 void 141 void
114 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box); 142 gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box);
115 143
116 void 144 void
120 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting); 148 gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting);
121 149
122 void 150 void
123 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box); 151 gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box);
124 152
125 char *gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box); 153 GtkGaimStatusBoxItemType gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box);
126 154
127 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box); 155 char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box);
128 156
129 G_END_DECLS 157 G_END_DECLS
130 158