Mon, 23 Oct 2006 19:43:45 +0000
[gaim-migrate @ 17568]
I'm an idiot.
| 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> | |
| 37 | ||
| 38 | G_BEGIN_DECLS | |
| 39 | ||
| 40 | #define GTK_GAIM_TYPE_STATUS_BOX (gtk_gaim_status_box_get_type ()) | |
| 41 | #define GTK_GAIM_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBox)) | |
| 42 | #define GTK_GAIM_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) | |
| 43 | #define GTK_GAIM_IS_STATUS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_GAIM_TYPE_STATUS_BOX)) | |
| 44 | #define GTK_GAIM_IS_STATUS_BOX_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_GAIM_TYPE_STATUS_BOX)) | |
| 45 | #define GTK_GAIM_STATUS_BOX_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_GAIM_TYPE_STATUS_BOX, GtkGaimStatusBoxClass)) | |
| 46 | ||
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
47 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
48 | * This is a hidden field in the GtkStatusBox that identifies the |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
49 | * item in the list store. The item could be a normal |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
50 | * GaimStatusPrimitive, or it could be something special like the |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
51 | * "Custom..." item, or "Saved..." or a GtkSeparator. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
52 | */ |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
53 | typedef enum |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
54 | { |
|
12779
b0d89f38aebb
[gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents:
12778
diff
changeset
|
55 | GTK_GAIM_STATUS_BOX_TYPE_SEPARATOR, |
|
b0d89f38aebb
[gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents:
12778
diff
changeset
|
56 | GTK_GAIM_STATUS_BOX_TYPE_PRIMITIVE, |
|
b0d89f38aebb
[gaim-migrate @ 15126]
Mark Doliner <markdoliner@pidgin.im>
parents:
12778
diff
changeset
|
57 | GTK_GAIM_STATUS_BOX_TYPE_POPULAR, |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
58 | GTK_GAIM_STATUS_BOX_TYPE_CUSTOM, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
59 | GTK_GAIM_STATUS_BOX_TYPE_SAVED, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
60 | GTK_GAIM_STATUS_BOX_NUM_TYPES |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
61 | } GtkGaimStatusBoxItemType; |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
62 | |
| 10643 | 63 | typedef struct _GtkGaimStatusBox GtkGaimStatusBox; |
| 64 | typedef struct _GtkGaimStatusBoxClass GtkGaimStatusBoxClass; | |
| 65 | ||
| 66 | struct _GtkGaimStatusBox | |
| 67 | { | |
| 14865 | 68 | GtkComboBox parent_instance; |
| 10643 | 69 | |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
70 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
71 | * This GtkListStore contains only one row--the currently selected status. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
72 | */ |
| 10643 | 73 | GtkListStore *store; |
|
11739
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
74 | |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
75 | /** |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
76 | * This is the dropdown GtkListStore that contains the available statuses, |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
77 | * plus some recently used statuses, plus the "Custom..." and "Saved..." |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
78 | * options. |
|
cc15987b3937
[gaim-migrate @ 14030]
Mark Doliner <markdoliner@pidgin.im>
parents:
11738
diff
changeset
|
79 | */ |
| 10643 | 80 | GtkListStore *dropdown_store; |
| 81 | ||
| 11499 | 82 | GaimAccount *account; |
| 83 | ||
|
14725
39980ddc0b9a
[gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
84 | /* This will be non-NULL and contain a sample account |
|
39980ddc0b9a
[gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
85 | * when all enabled accounts use the same statuses */ |
|
39980ddc0b9a
[gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
86 | GaimAccount *token_status_account; |
|
39980ddc0b9a
[gaim-migrate @ 17409]
Daniel Atallah <datallah@pidgin.im>
parents:
14253
diff
changeset
|
87 | |
| 10643 | 88 | GtkWidget *vbox, *sw; |
| 89 | GtkWidget *imhtml; | |
| 14195 | 90 | |
| 91 | char *buddy_icon_path; | |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
92 | GdkPixbuf *buddy_icon; |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
93 | GdkPixbuf *buddy_icon_hover; |
| 14195 | 94 | GtkWidget *buddy_icon_sel; |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
95 | GtkWidget *icon; |
| 14195 | 96 | GtkWidget *icon_box; |
| 97 | GdkCursor *hand_cursor; | |
| 98 | GdkCursor *arrow_cursor; | |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
99 | int icon_size; |
| 14195 | 100 | |
| 10643 | 101 | gboolean imhtml_visible; |
| 102 | ||
| 103 | GtkWidget *cell_view; | |
| 104 | GtkCellRenderer *icon_rend; | |
| 105 | GtkCellRenderer *text_rend; | |
| 106 | ||
| 107 | GdkPixbuf *error_pixbuf; | |
| 108 | int connecting_index; | |
| 109 | GdkPixbuf *connecting_pixbufs[4]; | |
| 110 | int typing_index; | |
| 111 | GdkPixbuf *typing_pixbufs[4]; | |
| 112 | ||
| 14767 | 113 | gboolean network_available; |
| 10643 | 114 | gboolean connecting; |
|
13124
1750c1be8e81
[gaim-migrate @ 15485]
Mark Doliner <markdoliner@pidgin.im>
parents:
13123
diff
changeset
|
115 | guint typing; |
| 10643 | 116 | |
| 117 | GtkTreeIter iter; | |
| 118 | char *error; | |
| 11960 | 119 | |
|
13122
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
120 | /* |
|
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
121 | * These widgets are made for renderin' |
|
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
122 | * That's just what they'll do |
|
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
123 | * One of these days these widgets |
|
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
124 | * Are gonna render all over you |
|
85136c011157
[gaim-migrate @ 15483]
Mark Doliner <markdoliner@pidgin.im>
parents:
12779
diff
changeset
|
125 | */ |
| 12262 | 126 | GtkWidget *hbox; |
| 127 | GtkWidget *toggle_button; | |
| 128 | GtkWidget *vsep; | |
| 129 | GtkWidget *arrow; | |
| 10643 | 130 | }; |
| 131 | ||
| 132 | struct _GtkGaimStatusBoxClass | |
| 133 | { | |
| 14865 | 134 | GtkComboBoxClass parent_class; |
| 10643 | 135 | |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
136 | /* signals */ |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
137 | void (* changed) (GtkComboBox *combo_box); |
| 10643 | 138 | |
|
14203
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
139 | /* Padding for future expansion */ |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
140 | void (*_gtk_reserved0) (void); |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
141 | void (*_gtk_reserved1) (void); |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
142 | void (*_gtk_reserved2) (void); |
|
f3a50c328ddc
[gaim-migrate @ 16783]
Mark Doliner <markdoliner@pidgin.im>
parents:
14195
diff
changeset
|
143 | void (*_gtk_reserved3) (void); |
| 10643 | 144 | }; |
| 145 | ||
| 146 | ||
| 147 | GType gtk_gaim_status_box_get_type (void) G_GNUC_CONST; | |
| 148 | GtkWidget *gtk_gaim_status_box_new (void); | |
| 11499 | 149 | GtkWidget *gtk_gaim_status_box_new_with_account (GaimAccount *); |
| 10643 | 150 | |
| 151 | void | |
|
12778
e98948ef3259
[gaim-migrate @ 15125]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12619
diff
changeset
|
152 | gtk_gaim_status_box_add(GtkGaimStatusBox *status_box, GtkGaimStatusBoxItemType type, GdkPixbuf *pixbuf, const char *text, const char *sec_text, gpointer data); |
| 10643 | 153 | |
| 154 | void | |
|
11738
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
155 | gtk_gaim_status_box_add_separator(GtkGaimStatusBox *status_box); |
|
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
156 | |
|
207d5519a4d0
[gaim-migrate @ 14029]
Mark Doliner <markdoliner@pidgin.im>
parents:
11732
diff
changeset
|
157 | void |
| 14767 | 158 | gtk_gaim_status_box_set_network_available(GtkGaimStatusBox *status_box, gboolean available); |
| 159 | ||
| 160 | void | |
| 10643 | 161 | gtk_gaim_status_box_set_connecting(GtkGaimStatusBox *status_box, gboolean connecting); |
| 162 | ||
| 163 | void | |
| 164 | gtk_gaim_status_box_pulse_connecting(GtkGaimStatusBox *status_box); | |
| 165 | ||
| 14195 | 166 | void |
| 167 | gtk_gaim_status_box_set_buddy_icon(GtkGaimStatusBox *status_box, const char *filename); | |
| 168 | ||
| 169 | const char * | |
| 170 | gtk_gaim_status_box_get_buddy_icon(GtkGaimStatusBox *status_box); | |
| 171 | ||
|
11638
1821b40269a3
[gaim-migrate @ 13914]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11499
diff
changeset
|
172 | char *gtk_gaim_status_box_get_message(GtkGaimStatusBox *status_box); |
| 10649 | 173 | |
| 10643 | 174 | G_END_DECLS |
| 175 | ||
| 176 | #endif /* __GTK_GAIM_GTK_STATUS_COMBO_BOX_H__ */ |