Sun, 23 Oct 2005 13:30:41 +0000
[gaim-migrate @ 14043]
Hey, Look! it's a GtkExpander that both compiles AND works with Gtk 2.2
Yay!
| 10643 | 1 | /* |
| 2 | * @file gtkstatusbox.c GTK+ Status Selection Widget | |
| 3 | * @ingroup gtkui | |
| 4 | * | |
| 5 | * gaim | |
| 6 | * | |
| 7 | * Gaim is the legal property of its developers, whose names are too numerous | |
| 8 | * to list here. Please refer to the COPYRIGHT file distributed with this | |
| 9 | * source distribution. | |
| 10 | * | |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 20 | * | |
| 21 | * You should have received a copy of the GNU General Public License | |
| 22 | * along with this program; if not, write to the Free Software | |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 24 | */ | |
| 25 | ||
| 26 | ||
| 27 | #ifndef __GTK_GAIM_STATUS_BOX_H__ | |
| 28 | #define __GTK_GAIM_STATUS_BOX_H__ | |
| 29 | ||
| 30 | #include <gtk/gtk.h> | |
| 31 | #include "gtkimhtml.h" | |
| 11499 | 32 | #include "account.h" |
|
11677
89c2ab8d2ebf
[gaim-migrate @ 13963]
Mark Doliner <markdoliner@pidgin.im>
parents:
11638
diff
changeset
|
33 | #include "savedstatuses.h" |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
34 | #include "status.h" |
| 10643 | 35 | #include <gtk/gtktreemodel.h> |
| 36 | #include <gtk/gtktreeview.h> | |
|
10703
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
37 | #if !GTK_CHECK_VERSION(2,6,0) |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
38 | # include "gtkcellview.h" |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
39 | # include "gtkcellviewmenuitem.h" |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
40 | # if !GTK_CHECK_VERSION(2,4,0) |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
41 | # include "gtkcelllayout.h" |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
42 | # include "gtkcombobox.h" |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
43 | # endif /* Gtk 2.4 */ |
|
7392ab91edf7
[gaim-migrate @ 12286]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10649
diff
changeset
|
44 | #endif /* Gtk 2.6 */ |
| 10643 | 45 | |
| 46 | G_BEGIN_DECLS | |
| 47 | ||
| 48 | #define GTK_GAIM_TYPE_STATUS_BOX (gtk_gaim_status_box_get_type ()) | |
| 49 | #define GTK_GAIM_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBox)) | |
| 50 | #define GTK_GAIM_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) | |
| 51 | #define GTK_GAIM_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 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)) | |
| 53 | #define GTK_GAIM_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) | |
| 54 | ||
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
55 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
56 | * This is a hidden field in the GtkStatusBox that identifies the |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
57 | * item in the list store. The item could be a normal |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
58 | * GaimStatusPrimitive, or it could be something special like the |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
59 | * "Custom..." item, or "Saved..." or a GtkSeparator. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
60 | */ |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
61 | typedef enum |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
62 | { |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
63 | /* |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
64 | * The first 0 through GAIM_STATUS_NUM_PRIMITIVES |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
65 | * correspond to GaimStatusPrimitives. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
66 | */ |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
67 | GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR = GAIM_STATUS_NUM_PRIMITIVES, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
68 | GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
69 | GTK_GAIM_STATUS_BOX_TYPE_SAVED, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
70 | GTK_GAIM_STATUS_BOX_NUM_TYPES |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
71 | } GtkGaimStatusBoxItemType; |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
72 | |
| 10643 | 73 | typedef struct _GtkGaimStatusBox GtkGaimStatusBox; |
| 74 | typedef struct _GtkGaimStatusBoxClass GtkGaimStatusBoxClass; | |
| 75 | ||
| 76 | struct _GtkGaimStatusBox | |
| 77 | { | |
| 78 | GtkComboBox parent_instance; | |
| 79 | ||
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
80 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
81 | * This GtkListStore contains only one row--the currently selected status. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
82 | */ |
| 10643 | 83 | GtkListStore *store; |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
84 | |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
85 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
86 | * This is the dropdown GtkListStore that contains the available statuses, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
87 | * plus some recently used statuses, plus the "Custom..." and "Saved..." |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
88 | * options. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
89 | */ |
| 10643 | 90 | GtkListStore *dropdown_store; |
| 91 | ||
| 11499 | 92 | GaimAccount *account; |
| 93 | ||
| 10643 | 94 | GtkWidget *vbox, *sw; |
| 95 | GtkWidget *imhtml; | |
| 96 | gboolean imhtml_visible; | |
| 97 | ||
| 98 | GtkWidget *cell_view; | |
| 99 | GtkCellRenderer *icon_rend; | |
| 100 | GtkCellRenderer *text_rend; | |
| 101 | ||
| 102 | GdkPixbuf *error_pixbuf; | |
| 103 | int connecting_index; | |
| 104 | GdkPixbuf *connecting_pixbufs[4]; | |
| 105 | int typing_index; | |
| 106 | GdkPixbuf *typing_pixbufs[4]; | |
| 107 | ||
| 108 | gboolean connecting; | |
| 109 | gboolean typing; | |
| 110 | ||
| 111 | ||
| 112 | GtkTreeIter iter; | |
| 113 | GdkPixbuf *pixbuf; | |
| 114 | char *title; | |
| 115 | char *desc; | |
| 116 | char *error; | |
| 117 | }; | |
| 118 | ||
| 119 | struct _GtkGaimStatusBoxClass | |
| 120 | { | |
| 121 | GtkComboBoxClass parent_class; | |
| 122 | ||
| 123 | /* signals */ | |
| 124 | void (* changed) (GtkComboBox *combo_box); | |
| 125 | ||
| 126 | /* Padding for future expansion */ | |
| 127 | void (*_gtk_reserved0) (void); | |
| 128 | void (*_gtk_reserved1) (void); | |
| 129 | void (*_gtk_reserved2) (void); | |
| 130 | void (*_gtk_reserved3) (void); | |
| 131 | }; | |
| 132 | ||
| 133 | ||
| 134 | GType gtk_gaim_status_box_get_type (void) G_GNUC_CONST; | |
| 135 | GtkWidget *gtk_gaim_status_box_new (void); | |
| 11499 | 136 | GtkWidget *gtk_gaim_status_box_new_with_account (GaimAccount *); |
| 10643 | 137 | |
| 138 | void | |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
139 | gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text); |
| 10643 | 140 | |
| 141 | void | |
|
11738
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
142 | gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box); |
|
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
143 | |
|
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
144 | void |
| 10643 | 145 | gtk_gaim_status_box_set_error(GtkGaimStatusBox *status_box, const gchar *error); |
| 146 | ||
| 147 | void | |
| 148 | gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting); | |
| 149 | ||
| 150 | void | |
| 151 | gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box); | |
| 152 | ||
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
153 | GtkGaimStatusBoxItemType gtk_gaim_status_box_get_active_type(GtkGaimStatusBox *status_box); |
| 10649 | 154 | |
|
11638
1821b40269a3
[gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11499
diff
changeset
|
155 | char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box); |
| 10649 | 156 | |
| 10643 | 157 | G_END_DECLS |
| 158 | ||
| 159 | #endif /* __GTK_GAIM_GTK_STATUS_COMBO_BOX_H__ */ |