annotate gtk/gaimcombobox.c @ 14200:5300e2f1fed3

[gaim-migrate @ 16872] Test program to detect keycodes. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 19 Aug 2006 05:44:40 +0000
parents 009db0b357b5
children 06591d48f8a4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1 /* gaimcombobox.c
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2 * Copyright (C) 2002, 2003 Kristian Rietveld <kris@gtk.org>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
4 * This library is free software; you can redistribute it and/or
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
5 * modify it under the terms of the GNU Library General Public
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
6 * License as published by the Free Software Foundation; either
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
7 * version 2 of the License, or (at your option) any later version.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
8 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
9 * This library is distributed in the hope that it will be useful,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
12 * Library General Public License for more details.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
13 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
14 * You should have received a copy of the GNU Library General Public
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
15 * License along with this library; if not, write to the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
17 * Boston, MA 02111-1307, USA.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
18 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
19
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
20 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
21 #include <config.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
22 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
23 #include <gtk/gtkversion.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
24 #if !GTK_CHECK_VERSION(2,4,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
25 #include "gaimcombobox.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
26
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
27 #include <gtk/gtkarrow.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
28 #include <gtk/gtkbindings.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
29 #include "gtkcelllayout.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
30 #include <gtk/gtkcellrenderertext.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
31 #include "gtkcellview.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
32 #include "gtkcellviewmenuitem.h"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
33 #include <gtk/gtkeventbox.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
34 #include <gtk/gtkframe.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
35 #include <gtk/gtkhbox.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
36 #include <gtk/gtkliststore.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
37 #include <gtk/gtkmain.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
38 #include <gtk/gtkmenu.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
39 #include <gtk/gtktogglebutton.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
40 #include <gtk/gtktreeselection.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
41 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
42 #include <gtk/gtktreeprivate.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
43 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
44 #include <gtk/gtkvseparator.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
45 #include <gtk/gtkwindow.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
46 #include <gtk/gtkversion.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
47
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
48 #include <gdk/gdkkeysyms.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
49
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
50 #include <gobject/gvaluecollector.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
51
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
52 #include <string.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
53 #include <stdarg.h>
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
54
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
55 #define P_(x) (x)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
56
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
57 /* WELCOME, to THE house of evil code */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
58
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
59 typedef struct _ComboCellInfo ComboCellInfo;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
60 struct _ComboCellInfo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
61 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
62 GtkCellRenderer *cell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
63 GSList *attributes;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
64
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
65 GtkCellLayoutDataFunc func;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
66 gpointer func_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
67 GDestroyNotify destroy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
68
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
69 guint expand : 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
70 guint pack : 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
71 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
72
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
73 struct _GtkComboBoxPrivate
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
74 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
75 GtkTreeModel *model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
76
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
77 gint col_column;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
78 gint row_column;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
79
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
80 gint wrap_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
81
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
82 gint active_item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
83
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
84 GtkWidget *tree_view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
85 GtkTreeViewColumn *column;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
86
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
87 GtkWidget *cell_view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
88 GtkWidget *cell_view_frame;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
89
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
90 GtkWidget *button;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
91 GtkWidget *box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
92 GtkWidget *arrow;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
93 GtkWidget *separator;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
94
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
95 GtkWidget *popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
96 GtkWidget *popup_window;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
97 GtkWidget *popup_frame;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
98
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
99 guint inserted_id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
100 guint deleted_id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
101 guint reordered_id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
102 guint changed_id;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
104 gint width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
105 GSList *cells;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
106
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
107 guint popup_in_progress : 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
108 guint destroying : 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
109 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
110
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
111 /* While debugging this evil code, I have learned that
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
112 * there are actually 4 modes to this widget, which can
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
113 * be characterized as follows
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
114 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
115 * 1) menu mode, no child added
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
116 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
117 * tree_view -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
118 * cell_view -> GtkCellView, regular child
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
119 * cell_view_frame -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
120 * button -> GtkToggleButton set_parent to combo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
121 * box -> child of button
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
122 * arrow -> child of box
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
123 * separator -> child of box
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
124 * popup_widget -> GtkMenu
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
125 * popup_window -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
126 * popup_frame -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
127 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
128 * 2) menu mode, child added
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
129 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
130 * tree_view -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
131 * cell_view -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
132 * cell_view_frame -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
133 * button -> GtkToggleButton set_parent to combo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
134 * box -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
135 * arrow -> GtkArrow, child of button
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
136 * separator -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
137 * popup_widget -> GtkMenu
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
138 * popup_window -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
139 * popup_frame -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
140 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
141 * 3) list mode, no child added
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
142 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
143 * tree_view -> GtkTreeView, child of popup_frame
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
144 * cell_view -> GtkCellView, regular child
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
145 * cell_view_frame -> GtkFrame, set parent to combo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
146 * button -> GtkToggleButton, set_parent to combo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
147 * box -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
148 * arrow -> GtkArrow, child of button
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
149 * separator -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
150 * popup_widget -> tree_view
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
151 * popup_window -> GtkWindow
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
152 * popup_frame -> GtkFrame, child of popup_window
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
153 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
154 * 4) list mode, child added
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
155 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
156 * tree_view -> GtkTreeView, child of popup_frame
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
157 * cell_view -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
158 * cell_view_frame -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
159 * button -> GtkToggleButton, set_parent to combo
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
160 * box -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
161 * arrow -> GtkArrow, child of button
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
162 * separator -> NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
163 * popup_widget -> tree_view
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
164 * popup_window -> GtkWindow
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
165 * popup_frame -> GtkFrame, child of popup_window
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
166 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
167 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
168
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
169 enum {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
170 CHANGED,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
171 LAST_SIGNAL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
172 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
173
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
174 enum {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
175 PROP_0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
176 PROP_MODEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
177 PROP_WRAP_WIDTH,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
178 PROP_ROW_SPAN_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
179 PROP_COLUMN_SPAN_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
180 PROP_ACTIVE
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
181 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
182
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
183 static GtkBinClass *parent_class = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
184 static guint combo_box_signals[LAST_SIGNAL] = {0,};
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
186 #define BONUS_PADDING 4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
187
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
189 /* common */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
190 static void gtk_combo_box_class_init (GtkComboBoxClass *klass);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
191 static void gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
192 static void gtk_combo_box_init (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
193 static void gtk_combo_box_finalize (GObject *object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
194 static void gtk_combo_box_destroy (GtkObject *object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
195
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
196 static void gtk_combo_box_set_property (GObject *object,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
197 guint prop_id,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
198 const GValue *value,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
199 GParamSpec *spec);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
200 static void gtk_combo_box_get_property (GObject *object,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
201 guint prop_id,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
202 GValue *value,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
203 GParamSpec *spec);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
205 static void gtk_combo_box_state_changed (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
206 GtkStateType previous);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
207 static void gtk_combo_box_style_set (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
208 GtkStyle *previous);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
209 static void gtk_combo_box_button_toggled (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
210 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
211 static void gtk_combo_box_add (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
212 GtkWidget *widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
213 static void gtk_combo_box_remove (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
214 GtkWidget *widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
215
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
216 static ComboCellInfo *gtk_combo_box_get_cell_info (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
217 GtkCellRenderer *cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
218
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
219 static void gtk_combo_box_menu_show (GtkWidget *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
220 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
221 static void gtk_combo_box_menu_hide (GtkWidget *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
222 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
223
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
224 static void gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
225 GtkWidget *popup);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
226 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
227 static void gtk_combo_box_menu_position_below (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
228 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
229 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
230 gint *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
231 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
232 static void gtk_combo_box_menu_position_over (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
233 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
234 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
235 gint *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
236 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
237 static void gtk_combo_box_menu_position (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
238 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
239 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
240 gint *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
241 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
242 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
243
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
244 static gint gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
245 GtkTreePath *path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
246 static void gtk_combo_box_remeasure (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
247
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
248 static void gtk_combo_box_unset_model (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
249
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
250 static void gtk_combo_box_size_request (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
251 GtkRequisition *requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
252 static void gtk_combo_box_size_allocate (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
253 GtkAllocation *allocation);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
254 static void gtk_combo_box_forall (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
255 gboolean include_internals,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
256 GtkCallback callback,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
257 gpointer callback_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
258 static gboolean gtk_combo_box_expose_event (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
259 GdkEventExpose *event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
260 static gboolean gtk_combo_box_scroll_event (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
261 GdkEventScroll *event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
262 static void gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
263 gint index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
264 static gboolean gtk_combo_box_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
265 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
266 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
267
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
268 /* listening to the model */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
269 static void gtk_combo_box_model_row_inserted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
270 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
271 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
272 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
273 static void gtk_combo_box_model_row_deleted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
274 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
275 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
276 static void gtk_combo_box_model_rows_reordered (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
277 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
278 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
279 gint *new_order,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
280 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
281 static void gtk_combo_box_model_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
282 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
283 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
284 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
285
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
286 /* list */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
287 static void gtk_combo_box_list_position (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
288 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
289 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
290 gint *width,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
291 gint *height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
292
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
293 static void gtk_combo_box_list_setup (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
294 static void gtk_combo_box_list_destroy (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
295
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
296 static void gtk_combo_box_list_remove_grabs (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
297
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
298 static gboolean gtk_combo_box_list_button_released (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
299 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
300 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
301 static gboolean gtk_combo_box_list_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
302 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
303 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
304 static gboolean gtk_combo_box_list_button_pressed (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
305 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
306 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
307
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
308 static void gtk_combo_box_list_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
309 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
310 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
311 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
312
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
313 /* menu */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
314 static void gtk_combo_box_menu_setup (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
315 gboolean add_children);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
316 static void gtk_combo_box_menu_fill (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
317 static void gtk_combo_box_menu_destroy (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
318
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
319 static void gtk_combo_box_item_get_size (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
320 gint index,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
321 gint *cols,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
322 gint *rows);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
323 static void gtk_combo_box_relayout_item (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
324 gint index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
325 static void gtk_combo_box_relayout (GtkComboBox *combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
326
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
327 static gboolean gtk_combo_box_menu_button_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
328 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
329 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
330 static void gtk_combo_box_menu_item_activate (GtkWidget *item,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
331 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
332 static void gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
333 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
334 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
335 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
336 static void gtk_combo_box_menu_row_deleted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
337 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
338 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
339 static void gtk_combo_box_menu_rows_reordered (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
340 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
341 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
342 gint *new_order,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
343 gpointer user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
344 static void gtk_combo_box_menu_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
345 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
346 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
347 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
348 static gboolean gtk_combo_box_menu_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
349 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
350 gpointer data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
352 /* cell layout */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
353 static void gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
354 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
355 gboolean expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
356 static void gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
357 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
358 gboolean expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
359 static void gtk_combo_box_cell_layout_clear (GtkCellLayout *layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
360 static void gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
361 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
362 const gchar *attribute,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
363 gint column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
364 static void gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
365 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
366 GtkCellLayoutDataFunc func,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
367 gpointer func_data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
368 GDestroyNotify destroy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
369 static void gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
370 GtkCellRenderer *cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
371 static void gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
372 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
373 gint position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
374 static gboolean gtk_combo_box_mnemonic_activate (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
375 gboolean group_cycling);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
376
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
377 static void cell_view_sync_cells (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
378 GtkCellView *cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
379
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
380 #if !GTK_CHECK_VERSION(2,4,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
381 static void gtk_menu_attach (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
382 GtkWidget *child,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
383 guint left_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
384 guint right_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
385 guint top_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
386 guint bottom_attach);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
387 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
388
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
389 GType
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
390 gtk_combo_box_get_type (void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
391 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
392 static GType combo_box_type = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
393
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
394 if (!combo_box_type)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
395 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
396 static const GTypeInfo combo_box_info =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
397 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
398 sizeof (GtkComboBoxClass),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
399 NULL, /* base_init */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
400 NULL, /* base_finalize */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
401 (GClassInitFunc) gtk_combo_box_class_init,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
402 NULL, /* class_finalize */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
403 NULL, /* class_data */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
404 sizeof (GtkComboBox),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
405 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
406 (GInstanceInitFunc) gtk_combo_box_init
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
407 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
408
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
409 static const GInterfaceInfo cell_layout_info =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
410 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
411 (GInterfaceInitFunc) gtk_combo_box_cell_layout_init,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
412 NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
413 NULL
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
414 };
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
416 combo_box_type = g_type_register_static (GTK_TYPE_BIN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
417 "GaimGtkComboBox",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
418 &combo_box_info,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
419 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
420
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
421 g_type_add_interface_static (combo_box_type,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
422 GTK_TYPE_CELL_LAYOUT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
423 &cell_layout_info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
424 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
425
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
426 return combo_box_type;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
427 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
428
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
429 /* common */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
430 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
431 gtk_combo_box_class_init (GtkComboBoxClass *klass)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
432 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
433 GObjectClass *object_class;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
434 GtkBindingSet *binding_set;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
435 GtkObjectClass *gtk_object_class;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
436 GtkContainerClass *container_class;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
437 GtkWidgetClass *widget_class;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
438
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
439 binding_set = gtk_binding_set_by_class (klass);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
440
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
441 container_class = (GtkContainerClass *)klass;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
442 container_class->forall = gtk_combo_box_forall;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
443 container_class->add = gtk_combo_box_add;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
444 container_class->remove = gtk_combo_box_remove;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
445
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
446 widget_class = (GtkWidgetClass *)klass;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
447 widget_class->size_allocate = gtk_combo_box_size_allocate;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
448 widget_class->size_request = gtk_combo_box_size_request;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
449 widget_class->expose_event = gtk_combo_box_expose_event;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
450 widget_class->scroll_event = gtk_combo_box_scroll_event;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
451 widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
452 widget_class->style_set = gtk_combo_box_style_set;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
453 widget_class->state_changed = gtk_combo_box_state_changed;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
454
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
455 gtk_object_class = (GtkObjectClass *)klass;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
456 gtk_object_class->destroy = gtk_combo_box_destroy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
457
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
458 object_class = (GObjectClass *)klass;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
459 object_class->finalize = gtk_combo_box_finalize;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
460 object_class->set_property = gtk_combo_box_set_property;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
461 object_class->get_property = gtk_combo_box_get_property;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
462
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
463 parent_class = g_type_class_peek_parent (klass);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
464
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
465 /* signals */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
466 combo_box_signals[CHANGED] =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
467 g_signal_new ("changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
468 G_OBJECT_CLASS_TYPE (klass),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
469 G_SIGNAL_RUN_LAST,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
470 G_STRUCT_OFFSET (GtkComboBoxClass, changed),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
471 NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
472 g_cclosure_marshal_VOID__VOID,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
473 G_TYPE_NONE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
474
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
475 /* properties */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
476 g_object_class_install_property (object_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
477 PROP_MODEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
478 g_param_spec_object ("model",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
479 P_("ComboBox model"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
480 P_("The model for the combo box"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
481 GTK_TYPE_TREE_MODEL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
482 G_PARAM_READWRITE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
483
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
484 g_object_class_install_property (object_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
485 PROP_WRAP_WIDTH,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
486 g_param_spec_int ("wrap_width",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
487 P_("Wrap width"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
488 P_("Wrap width for layouting the items in a grid"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
489 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
490 G_MAXINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
491 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
492 G_PARAM_READWRITE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
493
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
494 g_object_class_install_property (object_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
495 PROP_ROW_SPAN_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
496 g_param_spec_int ("row_span_column",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
497 P_("Row span column"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
498 P_("TreeModel column containing the row span values"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
499 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
500 G_MAXINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
501 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
502 G_PARAM_READWRITE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
503
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
504 g_object_class_install_property (object_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
505 PROP_COLUMN_SPAN_COLUMN,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
506 g_param_spec_int ("column_span_column",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
507 P_("Column span column"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
508
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
509 P_("TreeModel column containing the column span values"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
510 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
511 G_MAXINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
512 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
513 G_PARAM_READWRITE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
514
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
515 g_object_class_install_property (object_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
516 PROP_ACTIVE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
517 g_param_spec_int ("active",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
518 P_("Active item"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
519 P_("The item which is currently active"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
520 -1,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
521 G_MAXINT,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
522 -1,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
523 G_PARAM_READWRITE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
524
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
525 gtk_widget_class_install_style_property (widget_class,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
526 g_param_spec_boolean ("appears-as-list",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
527 P_("Appears as list"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
528 P_("Whether combobox dropdowns should look like lists rather than menus"),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
529 FALSE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
530 G_PARAM_READABLE));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
531 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
532
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
533 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
534 gtk_combo_box_cell_layout_init (GtkCellLayoutIface *iface)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
535 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
536 iface->pack_start = gtk_combo_box_cell_layout_pack_start;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
537 iface->pack_end = gtk_combo_box_cell_layout_pack_end;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
538 iface->clear = gtk_combo_box_cell_layout_clear;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
539 iface->add_attribute = gtk_combo_box_cell_layout_add_attribute;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
540 iface->set_cell_data_func = gtk_combo_box_cell_layout_set_cell_data_func;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
541 iface->clear_attributes = gtk_combo_box_cell_layout_clear_attributes;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
542 iface->reorder = gtk_combo_box_cell_layout_reorder;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
543 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
544
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
545 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
546 gtk_combo_box_init (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
547 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
548 combo_box->priv = g_new0(GtkComboBoxPrivate,1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
549
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
550 combo_box->priv->cell_view = gtk_cell_view_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
551 gtk_widget_set_parent (combo_box->priv->cell_view, GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
552 GTK_BIN (combo_box)->child = combo_box->priv->cell_view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
553 gtk_widget_show (combo_box->priv->cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
555 combo_box->priv->width = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
556 combo_box->priv->wrap_width = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
557
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
558 combo_box->priv->active_item = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
559 combo_box->priv->col_column = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
560 combo_box->priv->row_column = -1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
561 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
562
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
563 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
564 gtk_combo_box_set_property (GObject *object,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
565 guint prop_id,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
566 const GValue *value,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
567 GParamSpec *pspec)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
568 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
569 GtkComboBox *combo_box = GTK_COMBO_BOX (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
570
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
571 switch (prop_id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
572 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
573 case PROP_MODEL:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
574 gtk_combo_box_set_model (combo_box, g_value_get_object (value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
575 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
576
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
577 case PROP_WRAP_WIDTH:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
578 gtk_combo_box_set_wrap_width (combo_box, g_value_get_int (value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
579 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
580
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
581 case PROP_ROW_SPAN_COLUMN:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
582 gtk_combo_box_set_row_span_column (combo_box, g_value_get_int (value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
583 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
584
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
585 case PROP_COLUMN_SPAN_COLUMN:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
586 gtk_combo_box_set_column_span_column (combo_box, g_value_get_int (value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
587 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
588
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
589 case PROP_ACTIVE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
590 gtk_combo_box_set_active (combo_box, g_value_get_int (value));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
591 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
592
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
593 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
594 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
595 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
596 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
597
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
598 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
599 gtk_combo_box_get_property (GObject *object,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
600 guint prop_id,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
601 GValue *value,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
602 GParamSpec *pspec)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
603 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
604 GtkComboBox *combo_box = GTK_COMBO_BOX (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
605
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
606 switch (prop_id)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
607 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
608 case PROP_MODEL:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
609 g_value_set_object (value, combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
610 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
611
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
612 case PROP_WRAP_WIDTH:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
613 g_value_set_int (value, combo_box->priv->wrap_width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
614 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
615
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
616 case PROP_ROW_SPAN_COLUMN:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
617 g_value_set_int (value, combo_box->priv->row_column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
618 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
619
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
620 case PROP_COLUMN_SPAN_COLUMN:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
621 g_value_set_int (value, combo_box->priv->col_column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
622 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
623
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
624 case PROP_ACTIVE:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
625 g_value_set_int (value, gtk_combo_box_get_active (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
626 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
627
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
628 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
629 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
630 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
631 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
632 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
633
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
634 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
635 gtk_combo_box_state_changed (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
636 GtkStateType previous)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
637 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
638 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
639
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
640 if (GTK_WIDGET_REALIZED (widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
641 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
642 if (combo_box->priv->tree_view && combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
643 gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
644 &widget->style->base[GTK_WIDGET_STATE (widget)]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
645 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
647 gtk_widget_queue_draw (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
648 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
649
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
650 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
651 gtk_combo_box_check_appearance (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
652 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
653 gboolean appears_as_list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
654
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
655 /* if wrap_width > 0, then we are in grid-mode and forced to use
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
656 * unix style
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
657 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
658 if (combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
659 appears_as_list = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
660 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
661 gtk_widget_style_get (GTK_WIDGET (combo_box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
662 "appears-as-list", &appears_as_list,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
663 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
665 if (appears_as_list)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
666 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
667 /* Destroy all the menu mode widgets, if they exist. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
668 if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
669 gtk_combo_box_menu_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
670
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
671 /* Create the list mode widgets, if they don't already exist. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
672 if (!GTK_IS_TREE_VIEW (combo_box->priv->tree_view))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
673 gtk_combo_box_list_setup (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
674 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
675 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
676 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
677 /* Destroy all the list mode widgets, if they exist. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
678 if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
679 gtk_combo_box_list_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
680
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
681 /* Create the menu mode widgets, if they don't already exist. */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
682 if (!GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
683 gtk_combo_box_menu_setup (combo_box, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
684 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
685 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
686
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
687 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
688 gtk_combo_box_style_set (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
689 GtkStyle *previous)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
690 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
691 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
692
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
693 gtk_combo_box_check_appearance (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
695 if (combo_box->priv->tree_view && combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
696 gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
697 &widget->style->base[GTK_WIDGET_STATE (widget)]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
698 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
699
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
700 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
701 gtk_combo_box_button_toggled (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
702 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
703 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
704 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
705
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
706 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
707 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
708 if (!combo_box->priv->popup_in_progress)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
709 gtk_combo_box_popup (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
710 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
711 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
712 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
713 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
714
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
715 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
716 gtk_combo_box_add (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
717 GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
718 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
719 GtkComboBox *combo_box = GTK_COMBO_BOX (container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
720
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
721 if (combo_box->priv->cell_view && combo_box->priv->cell_view->parent)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
722 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
723 gtk_widget_unparent (combo_box->priv->cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
724 GTK_BIN (container)->child = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
725 gtk_widget_queue_resize (GTK_WIDGET (container));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
726 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
727
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
728 gtk_widget_set_parent (widget, GTK_WIDGET (container));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
729 GTK_BIN (container)->child = widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
730
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
731 if (combo_box->priv->cell_view &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
732 widget != combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
733 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
734 /* since the cell_view was unparented, it's gone now */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
735 combo_box->priv->cell_view = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
736
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
737 if (!combo_box->priv->tree_view && combo_box->priv->separator)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
738 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
739 gtk_container_remove (GTK_CONTAINER (combo_box->priv->separator->parent),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
740 combo_box->priv->separator);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
741 combo_box->priv->separator = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
742
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
743 gtk_widget_queue_resize (GTK_WIDGET (container));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
744 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
745 else if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
746 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
747 gtk_widget_unparent (combo_box->priv->cell_view_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
748 combo_box->priv->cell_view_frame = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
749 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
750 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
751 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
752
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
753 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
754 gtk_combo_box_remove (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
755 GtkWidget *widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
756 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
757 GtkComboBox *combo_box = GTK_COMBO_BOX (container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
758 gboolean appears_as_list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
759
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
760 gtk_widget_unparent (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
761 GTK_BIN (container)->child = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
762
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
763 if (combo_box->priv->destroying)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
764 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
765
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
766 gtk_widget_queue_resize (GTK_WIDGET (container));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
767
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
768 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
769 appears_as_list = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
770 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
771 appears_as_list = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
772
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
773 if (appears_as_list)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
774 gtk_combo_box_list_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
775 else if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
776 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
777 gtk_combo_box_menu_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
778 gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
779 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
780 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
781
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
782 if (!combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
783 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
784 combo_box->priv->cell_view = gtk_cell_view_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
785 gtk_widget_set_parent (combo_box->priv->cell_view, GTK_WIDGET (container));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
786 GTK_BIN (container)->child = combo_box->priv->cell_view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
787
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
788 gtk_widget_show (combo_box->priv->cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
789 gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
790 combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
791 cell_view_sync_cells (combo_box, GTK_CELL_VIEW (combo_box->priv->cell_view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
792 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
793
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
794
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
795 if (appears_as_list)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
796 gtk_combo_box_list_setup (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
797 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
798 gtk_combo_box_menu_setup (combo_box, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
799
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
800 gtk_combo_box_set_active_internal (combo_box, combo_box->priv->active_item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
801 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
802
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
803 static ComboCellInfo *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
804 gtk_combo_box_get_cell_info (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
805 GtkCellRenderer *cell)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
806 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
807 GSList *i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
808
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
809 for (i = combo_box->priv->cells; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
810 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
811 ComboCellInfo *info = (ComboCellInfo *)i->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
812
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
813 if (info && info->cell == cell)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
814 return info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
815 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
817 return NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
818 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
819
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
820 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
821 gtk_combo_box_menu_show (GtkWidget *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
822 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
823 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
824 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
825
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
826 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
827 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
828 combo_box->priv->popup_in_progress = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
829 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
830
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
831 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
832 gtk_combo_box_menu_hide (GtkWidget *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
833 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
834 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
835 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
836
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
837 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
838 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
839 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
840
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
841 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
842 gtk_combo_box_detacher (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
843 GtkMenu *menu)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
844 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
845 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
846
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
847 g_return_if_fail (GTK_IS_COMBO_BOX (widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
848
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
849 combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
850 g_return_if_fail (combo_box->priv->popup_widget == (GtkWidget*) menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
851
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
852 g_signal_handlers_disconnect_by_func (menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
853 gtk_combo_box_menu_show,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
854 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
855 g_signal_handlers_disconnect_by_func (menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
856 gtk_combo_box_menu_hide,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
857 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
858
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
859 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
860 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
861
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
862 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
863 gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
864 GtkWidget *popup)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
865 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
866 if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
867 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
868 gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
869 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
870 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
871 else if (combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
872 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
873 gtk_container_remove (GTK_CONTAINER (combo_box->priv->popup_frame),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
874 combo_box->priv->popup_widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
875 g_object_unref (G_OBJECT (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
876 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
877 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
878
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
879 if (GTK_IS_MENU (popup))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
880 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
881 if (combo_box->priv->popup_window)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
882 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
883 gtk_widget_destroy (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
884 combo_box->priv->popup_window = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
885 combo_box->priv->popup_frame = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
886 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
887
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
888 combo_box->priv->popup_widget = popup;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
889
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
890 g_signal_connect (popup, "show",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
891 G_CALLBACK (gtk_combo_box_menu_show), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
892 g_signal_connect (popup, "hide",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
893 G_CALLBACK (gtk_combo_box_menu_hide), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
894
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
895 gtk_menu_attach_to_widget (GTK_MENU (popup),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
896 GTK_WIDGET (combo_box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
897 gtk_combo_box_detacher);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
898 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
899 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
900 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
901 if (!combo_box->priv->popup_window)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
902 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
903 combo_box->priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
904 gtk_window_set_resizable (GTK_WINDOW (combo_box->priv->popup_window), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
905 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
906 gtk_window_set_screen (GTK_WINDOW (combo_box->priv->popup_window),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
907 gtk_widget_get_screen (GTK_WIDGET (combo_box)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
908 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
909
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
910 combo_box->priv->popup_frame = gtk_frame_new (NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
911 gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->popup_frame),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
912 GTK_SHADOW_ETCHED_IN);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
913 gtk_container_add (GTK_CONTAINER (combo_box->priv->popup_window),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
914 combo_box->priv->popup_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
915
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
916 gtk_widget_show (combo_box->priv->popup_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
917 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
918
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
919 gtk_container_add (GTK_CONTAINER (combo_box->priv->popup_frame),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
920 popup);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
921 gtk_widget_show (popup);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
922 g_object_ref (G_OBJECT (popup));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
923 combo_box->priv->popup_widget = popup;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
924 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
925 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
926
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
927 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
928 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
929 gtk_combo_box_menu_position_below (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
930 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
931 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
932 gint *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
933 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
934 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
935 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
936 gint sx, sy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
937 GtkWidget *child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
938 GtkRequisition req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
939 GdkScreen *screen;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
940 gint monitor_num;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
941 GdkRectangle monitor;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
942
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
943 /* FIXME: is using the size request here broken? */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
944 child = GTK_BIN (combo_box)->child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
945
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
946 gdk_window_get_origin (child->window, &sx, &sy);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
947
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
948 if (GTK_WIDGET_NO_WINDOW (child))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
949 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
950 sx += child->allocation.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
951 sy += child->allocation.y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
952 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
953
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
954 gtk_widget_size_request (GTK_WIDGET (menu), &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
955
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
956 if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_LTR)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
957 *x = sx;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
958 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
959 *x = sx + child->allocation.width - req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
960 *y = sy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
961
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
962 screen = gtk_widget_get_screen (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
963 monitor_num = gdk_screen_get_monitor_at_window (screen,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
964 GTK_WIDGET (combo_box)->window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
965 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
966
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
967 if (*x < monitor.x)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
968 *x = monitor.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
969 else if (*x + req.width > monitor.x + monitor.width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
970 *x = monitor.x + monitor.width - req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
971
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
972 if (monitor.y + monitor.height - *y - child->allocation.height >= req.height)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
973 *y += child->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
974 else if (*y - monitor.y >= req.height)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
975 *y -= req.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
976 else if (monitor.y + monitor.height - *y - child->allocation.height > *y - monitor.y)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
977 *y += child->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
978 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
979 *y -= req.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
980
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
981 *push_in = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
982 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
983
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
984 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
985 gtk_combo_box_menu_position_over (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
986 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
987 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
988 gboolean *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
989 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
990 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
991 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
992 GtkWidget *active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
993 GtkWidget *child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
994 GtkWidget *widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
995 GtkRequisition requisition;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
996 GList *children;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
997 gint screen_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
998 gint menu_xpos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
999 gint menu_ypos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1000 gint menu_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1001
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1002 g_return_if_fail (GTK_IS_COMBO_BOX (user_data));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1003
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1004 combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1005 widget = GTK_WIDGET (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1006
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1007 gtk_widget_get_child_requisition (GTK_WIDGET (menu), &requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1008 menu_width = requisition.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1009
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1010 active = gtk_menu_get_active (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1011 gdk_window_get_origin (widget->window, &menu_xpos, &menu_ypos);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1012
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1013 menu_xpos += widget->allocation.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1014 menu_ypos += widget->allocation.y + widget->allocation.height / 2 - 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1015
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1016 if (active != NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1017 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1018 gtk_widget_get_child_requisition (active, &requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1019 menu_ypos -= requisition.height / 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1020 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1021
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1022 children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->children;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1023 while (children)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1024 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1025 child = children->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1026
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1027 if (active == child)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1028 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1029
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1030 if (GTK_WIDGET_VISIBLE (child))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1031 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1032 gtk_widget_get_child_requisition (child, &requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1033 menu_ypos -= requisition.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1034 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1035
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1036 children = children->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1037 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1038
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1039 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1040 menu_xpos = menu_xpos + widget->allocation.width - menu_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1041
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1042 /* Clamp the position on screen */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1043 screen_width = gdk_screen_get_width (gtk_widget_get_screen (widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1044
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1045 if (menu_xpos < 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1046 menu_xpos = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1047 else if ((menu_xpos + menu_width) > screen_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1048 menu_xpos -= ((menu_xpos + menu_width) - screen_width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1049
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1050 *x = menu_xpos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1051 *y = menu_ypos;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1053 *push_in = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1054 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1055
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1056 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1057 gtk_combo_box_menu_position (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1058 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1059 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1060 gint *push_in,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1061 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1062 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1063 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1064 GtkWidget *menu_item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1065
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1066 combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1067
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1068 if (combo_box->priv->wrap_width > 0 || combo_box->priv->cell_view == NULL)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1069 gtk_combo_box_menu_position_below (menu, x, y, push_in, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1070 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1071 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1072 menu_item = gtk_menu_get_active (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1073 if (menu_item)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1074 gtk_menu_shell_select_item (GTK_MENU_SHELL (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1075 menu_item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1076
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1077 gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1078 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1079
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1080 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1081 #endif /* Gtk 2.2 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1082
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1083 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1084 gtk_combo_box_list_position (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1085 gint *x,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1086 gint *y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1087 gint *width,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1088 gint *height)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1089 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1090 GtkWidget *sample;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1091 GtkRequisition popup_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1092 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1093 GdkScreen *screen;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1094 gint monitor_num;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1095 GdkRectangle monitor;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1096 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1097
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1098 sample = GTK_BIN (combo_box)->child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1099
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1100 *width = sample->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1101 gtk_widget_size_request (combo_box->priv->popup_window, &popup_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1102 *height = popup_req.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1103
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1104 gdk_window_get_origin (sample->window, x, y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1106 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1107 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1108 *x -= GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1109 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1110 *width += 2 * (GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1111 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1112 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1113
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1114 if (GTK_WIDGET_NO_WINDOW (sample))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1115 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1116 *x += sample->allocation.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1117 *y += sample->allocation.y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1118 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1119
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1120 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1121 screen = gtk_widget_get_screen (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1122 monitor_num = gdk_screen_get_monitor_at_window (screen,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1123 GTK_WIDGET (combo_box)->window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1124 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1125
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1126 if (*x < monitor.x)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1127 *x = monitor.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1128 else if (*x + *width > monitor.x + monitor.width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1129 *x = monitor.x + monitor.width - *width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1130
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1131 if (*y + sample->allocation.height + *height <= monitor.y + monitor.height)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1132 *y += sample->allocation.height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1133 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1134 *y -= *height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1135 #endif /* Gtk 2.2 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1136 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1137
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1138 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1139 * gtk_combo_box_popup:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1140 * @combo_box: a #GtkComboBox
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1141 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1142 * Pops up the menu or dropdown list of @combo_box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1143 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1144 * This function is mostly intended for use by accessibility technologies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1145 * applications should have little use for it.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1146 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1147 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1148 **/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1149 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1150 gtk_combo_box_popup (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1151 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1152 gint x, y, width, height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1153
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1154 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1155
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1156 if (GTK_WIDGET_MAPPED (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1157 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1158
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1159 if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1160 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1161 gtk_menu_set_active (GTK_MENU (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1162 combo_box->priv->active_item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1163
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1164 if (combo_box->priv->wrap_width == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1165 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1166 GtkRequisition requisition;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1167
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1168 width = GTK_WIDGET (combo_box)->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1169 gtk_widget_size_request (combo_box->priv->popup_widget, &requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1170
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1171 gtk_widget_set_size_request (combo_box->priv->popup_widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1172 MAX (width, requisition.width), -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1173 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1174
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1175 gtk_menu_popup (GTK_MENU (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1176 NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1177 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1178 gtk_combo_box_menu_position,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1179 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1180 NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1181 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1182 combo_box, 0, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1183 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1184 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1186 gtk_widget_show_all (combo_box->priv->popup_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1187 gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1189 gtk_widget_set_size_request (combo_box->priv->popup_window, width, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1190 gtk_window_move (GTK_WINDOW (combo_box->priv->popup_window), x, y);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1191
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1192 /* popup */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1193 gtk_widget_show (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1194
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1195 gtk_widget_grab_focus (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1196 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1197 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1198
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1199 if (!GTK_WIDGET_HAS_FOCUS (combo_box->priv->tree_view))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1200 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1201 gdk_keyboard_grab (combo_box->priv->popup_window->window,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1202 FALSE, GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1203 gtk_widget_grab_focus (combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1204 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1205
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1206 gtk_grab_add (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1207 gdk_pointer_grab (combo_box->priv->popup_window->window, TRUE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1208 GDK_BUTTON_PRESS_MASK |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1209 GDK_BUTTON_RELEASE_MASK |
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1210 GDK_POINTER_MOTION_MASK,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1211 NULL, NULL, GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1212
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1213 gtk_grab_add (combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1214 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1215
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1216 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1217 * gtk_combo_box_popdown:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1218 * @combo_box: a #GtkComboBox
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1219 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1220 * Hides the menu or dropdown list of @combo_box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1221 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1222 * This function is mostly intended for use by accessibility technologies;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1223 * applications should have little use for it.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1224 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1225 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1226 **/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1227 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1228 gtk_combo_box_popdown (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1229 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1230 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1231
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1232 if (!GTK_WIDGET_REALIZED (GTK_WIDGET (combo_box)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1233 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1234
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1235 if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1236 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1237 gtk_menu_popdown (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1238 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1239 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1240
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1241 gtk_combo_box_list_remove_grabs (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1242 gtk_widget_hide_all (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1243 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1244 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1245 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1246
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1247 static gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1248 gtk_combo_box_calc_requested_width (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1249 GtkTreePath *path)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1250 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1251 gint padding;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1252 GtkRequisition req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1254 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1255 gtk_widget_style_get (combo_box->priv->cell_view,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1256 "focus-line-width", &padding,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1257 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1258 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1259 padding = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1260
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1261 /* add some pixels for good measure */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1262 padding += BONUS_PADDING;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1263
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1264 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1265 gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1266 path, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1267 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1268 req.width = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1269
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1270 return req.width + padding;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1271 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1272
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1273 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1274 gtk_combo_box_remeasure (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1275 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1276 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1277 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1278 gint padding = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1279
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1280 if (!combo_box->priv->model ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1281 !gtk_tree_model_get_iter_first (combo_box->priv->model, &iter))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1282 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1283
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1284 combo_box->priv->width = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1285
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1286 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1287 path = gtk_tree_path_new_from_indices (0, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1288 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1289 path = gtk_tree_path_new_first();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1290 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1291
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1292 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1293 gtk_widget_style_get (combo_box->priv->cell_view,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1294 "focus-line-width", &padding,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1295 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1296 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1297 padding = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1298
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1299 /* add some pixels for good measure */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1300 padding += BONUS_PADDING;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1301
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1302 do
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1303 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1304 GtkRequisition req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1305
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1306 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1307 gtk_cell_view_get_size_of_row (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1308 path, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1309 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1310 req.width = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1311
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1312 combo_box->priv->width = MAX (combo_box->priv->width,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1313 req.width + padding);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1314
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1315 gtk_tree_path_next (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1316 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1317 while (gtk_tree_model_iter_next (combo_box->priv->model, &iter));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1318
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1319 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1320 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1321
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1322 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1323 gtk_combo_box_size_request (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1324 GtkRequisition *requisition)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1325 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1326 gint width, height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1327 GtkRequisition bin_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1328
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1329 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1330
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1331 /* common */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1332 gtk_widget_size_request (GTK_BIN (widget)->child, &bin_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1333 gtk_combo_box_remeasure (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1334 bin_req.width = MAX (bin_req.width, combo_box->priv->width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1335
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1336 gtk_combo_box_check_appearance (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1337
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1338 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1339 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1340 /* menu mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1341
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1342 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1343 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1344 GtkRequisition button_req, sep_req, arrow_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1345 gint border_width, xthickness, ythickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1346
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1347 gtk_widget_size_request (combo_box->priv->button, &button_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1348 border_width = GTK_CONTAINER (combo_box->priv->button)->border_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1349 xthickness = combo_box->priv->button->style->xthickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1350 ythickness = combo_box->priv->button->style->ythickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1352 bin_req.width = MAX (bin_req.width, combo_box->priv->width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1353
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1354 gtk_widget_size_request (combo_box->priv->separator, &sep_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1355 gtk_widget_size_request (combo_box->priv->arrow, &arrow_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1356
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1357 height = MAX (sep_req.height, arrow_req.height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1358 height = MAX (height, bin_req.height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1359
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1360 width = bin_req.width + sep_req.width + arrow_req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1361
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1362 height += border_width + 1 + ythickness * 2 + 4;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1363 width += border_width + 1 + xthickness * 2 + 4;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1364
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1365 requisition->width = width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1366 requisition->height = height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1367 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1368 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1369 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1370 GtkRequisition but_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1371
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1372 gtk_widget_size_request (combo_box->priv->button, &but_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1373
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1374 requisition->width = bin_req.width + but_req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1375 requisition->height = MAX (bin_req.height, but_req.height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1376 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1377 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1378 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1379 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1380 /* list mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1381 GtkRequisition button_req, frame_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1382
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1383 /* sample + frame */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1384 *requisition = bin_req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1385
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1386 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1387 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1388 gtk_widget_size_request (combo_box->priv->cell_view_frame, &frame_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1389 requisition->width += 2 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1390 (GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1391 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1392 requisition->height += 2 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1393 (GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1394 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1395 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1396
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1397 /* the button */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1398 gtk_widget_size_request (combo_box->priv->button, &button_req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1399
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1400 requisition->height = MAX (requisition->height, button_req.height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1401 requisition->width += button_req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1402 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1403 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1404
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1405 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1406 gtk_combo_box_size_allocate (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1407 GtkAllocation *allocation)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1408 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1409 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1410 GtkAllocation child;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1411 GtkRequisition req;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1412 gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1413
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1414 widget->allocation = *allocation;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1416 gtk_combo_box_check_appearance (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1417
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1418 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1419 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1420 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1421 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1422 gint border_width, xthickness, ythickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1423 gint width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1424
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1425 /* menu mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1426 gtk_widget_size_allocate (combo_box->priv->button, allocation);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1427
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1428 /* set some things ready */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1429 border_width = GTK_CONTAINER (combo_box->priv->button)->border_width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1430 xthickness = combo_box->priv->button->style->xthickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1431 ythickness = combo_box->priv->button->style->ythickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1432
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1433 child.x = allocation->x + border_width + 1 + xthickness + 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1434 child.y = allocation->y + border_width + 1 + ythickness + 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1436 width = MAX(1, allocation->width - (border_width + 1 + xthickness * 2 + 4));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1437
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1438 /* handle the children */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1439 gtk_widget_size_request (combo_box->priv->arrow, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1440 child.width = req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1441 child.height = MAX(1, allocation->height - 2 * (child.y - allocation->y));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1442 if (!is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1443 child.x += width - req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1444 gtk_widget_size_allocate (combo_box->priv->arrow, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1445 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1446 child.x += req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1447 gtk_widget_size_request (combo_box->priv->separator, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1448 child.width = req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1449 if (!is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1450 child.x -= req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1451 gtk_widget_size_allocate (combo_box->priv->separator, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1452
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1453 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1454 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1455 child.x += req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1456 child.width = MAX(1, allocation->x + allocation->width
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1457 - (border_width + 1 + xthickness + 2) - child.x);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1458 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1459 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1460 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1461 child.width = child.x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1462 child.x = allocation->x + border_width + 1 + xthickness + 2;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1463 child.width = MAX(1, child.width - child.x);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1464 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1465
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1466 gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1467 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1468 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1469 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1470 gtk_widget_size_request (combo_box->priv->button, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1471 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1472 child.x = allocation->x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1473 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1474 child.x = allocation->x + allocation->width - req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1475 child.y = allocation->y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1476 child.width = req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1477 child.height = allocation->height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1478 gtk_widget_size_allocate (combo_box->priv->button, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1479
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1480 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1481 child.x = allocation->x + req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1482 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1483 child.x = allocation->x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1484 child.y = allocation->y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1485 child.width = MAX(1, allocation->width - req.width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1486 gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1487 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1488 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1489 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1490 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1491 /* list mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1492
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1493 /* button */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1494 gtk_widget_size_request (combo_box->priv->button, &req);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1495 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1496 child.x = allocation->x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1497 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1498 child.x = allocation->x + allocation->width - req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1499 child.y = allocation->y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1500 child.width = req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1501 child.height = allocation->height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1502 gtk_widget_size_allocate (combo_box->priv->button, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1503
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1504 /* frame */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1505 if (is_rtl)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1506 child.x = allocation->x + req.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1507 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1508 child.x = allocation->x;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1509 child.y = allocation->y;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1510 child.width = MAX (1, allocation->width - req.width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1511 child.height = allocation->height;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1512
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1513 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1514 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1515 gtk_widget_size_allocate (combo_box->priv->cell_view_frame, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1516
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1517 /* the sample */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1518 child.x +=
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1519 GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1520 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1521 child.y +=
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1522 GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1523 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1524 child.width -= 2 * (
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1525 GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1526 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1527 child.width = MAX(1,child.width);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1528 child.height -= 2 * (
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1529 GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1530 GTK_WIDGET (combo_box->priv->cell_view_frame)->style->ythickness);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1531 child.height = MAX(1,child.height);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1532 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1533
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1534 gtk_widget_size_allocate (GTK_BIN (combo_box)->child, &child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1535 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1536 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1537
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1538 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1539 gtk_combo_box_unset_model (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1540 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1541 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1542 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1543 g_signal_handler_disconnect (combo_box->priv->model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1544 combo_box->priv->inserted_id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1545 g_signal_handler_disconnect (combo_box->priv->model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1546 combo_box->priv->deleted_id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1547 g_signal_handler_disconnect (combo_box->priv->model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1548 combo_box->priv->reordered_id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1549 g_signal_handler_disconnect (combo_box->priv->model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1550 combo_box->priv->changed_id);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1551 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1552
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1553 /* menu mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1554 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1555 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1556 if (combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1557 gtk_container_foreach (GTK_CONTAINER (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1558 (GtkCallback)gtk_widget_destroy, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1559 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1561 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1562 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1563 g_object_unref (G_OBJECT (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1564 combo_box->priv->model = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1565 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1566
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1567 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1568 gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->cell_view), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1569 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1570
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1571 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1572 gtk_combo_box_forall (GtkContainer *container,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1573 gboolean include_internals,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1574 GtkCallback callback,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1575 gpointer callback_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1576 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1577 GtkComboBox *combo_box = GTK_COMBO_BOX (container);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1578
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1579 if (include_internals)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1580 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1581 if (combo_box->priv->button)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1582 (* callback) (combo_box->priv->button, callback_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1583 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1584 (* callback) (combo_box->priv->cell_view_frame, callback_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1585 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1586
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1587 if (GTK_BIN (container)->child)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1588 (* callback) (GTK_BIN (container)->child, callback_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1589 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1590
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1591 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1592 gtk_combo_box_expose_event (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1593 GdkEventExpose *event)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1594 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1595 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1596
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1597 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1598 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1599 gtk_container_propagate_expose (GTK_CONTAINER (widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1600 combo_box->priv->button, event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1601 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1602 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1603 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1604 gtk_container_propagate_expose (GTK_CONTAINER (widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1605 combo_box->priv->button, event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1606
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1607 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1608 gtk_container_propagate_expose (GTK_CONTAINER (widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1609 combo_box->priv->cell_view_frame, event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1610 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1611
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1612 gtk_container_propagate_expose (GTK_CONTAINER (widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1613 GTK_BIN (widget)->child, event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1614
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1615 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1616 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1617
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1618 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1619 gtk_combo_box_scroll_event (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1620 GdkEventScroll *event)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1621 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1622 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1623 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1624 gint items;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1625
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1626 index = gtk_combo_box_get_active (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1627
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1628 if (index != -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1629 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1630 items = gtk_tree_model_iter_n_children (combo_box->priv->model, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1631
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1632 if (event->direction == GDK_SCROLL_UP)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1633 index--;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1634 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1635 index++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1636
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1637 gtk_combo_box_set_active (combo_box, CLAMP (index, 0, items - 1));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1638 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1639
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1640 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1641 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1642
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1643 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1644 * menu style
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1645 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1646
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1647 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1648 cell_view_sync_cells (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1649 GtkCellView *cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1650 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1651 GSList *k;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1652
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1653 for (k = combo_box->priv->cells; k; k = k->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1654 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1655 GSList *j;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1656 ComboCellInfo *info = (ComboCellInfo *)k->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1657
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1658 if (info->pack == GTK_PACK_START)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1659 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1660 info->cell, info->expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1661 else if (info->pack == GTK_PACK_END)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1662 gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1663 info->cell, info->expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1665 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1666 info->cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1667 info->func, info->func_data, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1668
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1669 for (j = info->attributes; j; j = j->next->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1670 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1671 gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1672 info->cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1673 j->data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1674 GPOINTER_TO_INT (j->next->data));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1675 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1676 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1677 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1678
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1679 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1680 gtk_combo_box_menu_setup (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1681 gboolean add_children)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1682 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1683 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1684
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1685 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1686 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1687 combo_box->priv->button = gtk_toggle_button_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1688 g_signal_connect (combo_box->priv->button, "toggled",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1689 G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1690 g_signal_connect_after (combo_box->priv->button, "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1691 G_CALLBACK (gtk_combo_box_key_press), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1692 gtk_widget_set_parent (combo_box->priv->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1693 GTK_BIN (combo_box)->child->parent);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1695 combo_box->priv->box = gtk_hbox_new (FALSE, 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1696 gtk_container_add (GTK_CONTAINER (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1697 combo_box->priv->box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1698
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1699 combo_box->priv->separator = gtk_vseparator_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1700 gtk_container_add (GTK_CONTAINER (combo_box->priv->box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1701 combo_box->priv->separator);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1702
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1703 combo_box->priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1704 gtk_container_add (GTK_CONTAINER (combo_box->priv->box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1705 combo_box->priv->arrow);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1706
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1707 gtk_widget_show_all (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1708 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1709 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1710 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1711 combo_box->priv->button = gtk_toggle_button_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1712 g_signal_connect (combo_box->priv->button, "toggled",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1713 G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1714 g_signal_connect_after (combo_box, "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1715 G_CALLBACK (gtk_combo_box_key_press), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1716 gtk_widget_set_parent (combo_box->priv->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1717 GTK_BIN (combo_box)->child->parent);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1718
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1719 combo_box->priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1720 gtk_container_add (GTK_CONTAINER (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1721 combo_box->priv->arrow);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1722 gtk_widget_show_all (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1723 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1724
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1725 g_signal_connect (combo_box->priv->button, "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1726 G_CALLBACK (gtk_combo_box_menu_button_press),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1727 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1728
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1729 /* create our funky menu */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1730 menu = gtk_menu_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1731 g_signal_connect (menu, "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1732 G_CALLBACK (gtk_combo_box_menu_key_press), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1733 gtk_combo_box_set_popup_widget (combo_box, menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1734
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1735 /* add items */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1736 if (add_children)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1737 gtk_combo_box_menu_fill (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1738
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1739 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1740
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1741 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1742 gtk_combo_box_menu_fill (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1743 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1744 gint i, items;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1745 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1746 GtkWidget *tmp;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1747
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1748 if (!combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1749 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1750
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1751 items = gtk_tree_model_iter_n_children (combo_box->priv->model, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1752 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1753
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1754 for (i = 0; i < items; i++)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1755 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1756 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1757 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1758 path = gtk_tree_path_new_from_indices (i, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1759 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1760 char buf[32];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1761 g_snprintf(buf, sizeof(buf), "%d", i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1762 path = gtk_tree_path_new_from_string(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1763 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1764 tmp = gtk_cell_view_menu_item_new_from_model (combo_box->priv->model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1765 path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1766 g_signal_connect (tmp, "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1767 G_CALLBACK (gtk_combo_box_menu_item_activate),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1768 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1769
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1770 cell_view_sync_cells (combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1771 GTK_CELL_VIEW (GTK_BIN (tmp)->child));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1772
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1773 gtk_menu_shell_append (GTK_MENU_SHELL (menu), tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1774
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1775 if (combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1776 gtk_combo_box_relayout_item (combo_box, i);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1777
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1778 gtk_widget_show (tmp);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1779
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1780 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1781 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1782 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1783
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1784 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1785 gtk_combo_box_menu_destroy (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1786 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1787 g_signal_handlers_disconnect_matched (combo_box->priv->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1788 G_SIGNAL_MATCH_DATA,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1789 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1790 gtk_combo_box_menu_button_press, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1791
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1792 /* unparent will remove our latest ref */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1793 gtk_widget_unparent (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1794
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1795 combo_box->priv->box = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1796 combo_box->priv->button = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1797 combo_box->priv->arrow = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1798 combo_box->priv->separator = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1799
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1800 /* changing the popup window will unref the menu and the children */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1801 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1802
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1803 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1804 * grid
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1805 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1806
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1807 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1808 gtk_combo_box_item_get_size (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1809 gint index_,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1810 gint *cols,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1811 gint *rows)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1812 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1813 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1814
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1815 gtk_tree_model_iter_nth_child (combo_box->priv->model, &iter, NULL, index_);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1816
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1817 if (cols)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1818 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1819 if (combo_box->priv->col_column == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1820 *cols = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1821 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1822 gtk_tree_model_get (combo_box->priv->model, &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1823 combo_box->priv->col_column, cols,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1824 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1825 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1826
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1827 if (rows)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1828 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1829 if (combo_box->priv->row_column == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1830 *rows = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1831 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1832 gtk_tree_model_get (combo_box->priv->model, &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1833 combo_box->priv->row_column, rows,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1834 -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1835 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1836 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1837
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1838 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1839 menu_occupied (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1840 guint left_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1841 guint right_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1842 guint top_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1843 guint bottom_attach)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1844 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1845 GList *i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1846
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1847 g_return_val_if_fail (GTK_IS_MENU (menu), TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1848 g_return_val_if_fail (left_attach < right_attach, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1849 g_return_val_if_fail (top_attach < bottom_attach, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1850
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1851 for (i = GTK_MENU_SHELL (menu)->children; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1852 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1853 guint l, r, b, t;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1854 gboolean h_intersect = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1855 gboolean v_intersect = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1856
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1857 gtk_container_child_get (GTK_CONTAINER (menu), i->data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1858 "left_attach", &l,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1859 "right_attach", &r,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1860 "bottom_attach", &b,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1861 "top_attach", &t,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1862 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1863
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1864 /* look if this item intersects with the given coordinates */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1865 h_intersect = left_attach <= l && l <= right_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1866 h_intersect &= left_attach <= r && r <= right_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1867
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1868 v_intersect = top_attach <= t && t <= bottom_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1869 v_intersect &= top_attach <= b && b <= bottom_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1870
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1871 if (h_intersect && v_intersect)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1872 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1873 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1874
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1875 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1876 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1877
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1878 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1879 gtk_combo_box_relayout_item (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1880 gint index)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1881 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1882 gint current_col = 0, current_row = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1883 gint rows, cols;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1884 GList *list, *nth;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1885 GtkWidget *item, *last;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1886 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1887
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1888 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1889 if (!GTK_IS_MENU_SHELL (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1890 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1891
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1892 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1893 nth = g_list_nth (list, index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1894 item = nth->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1895 if (nth->prev)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1896 last = nth->prev->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1897 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1898 last = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1899 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1900
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1901 gtk_combo_box_item_get_size (combo_box, index, &cols, &rows);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1902
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1903 if (combo_box->priv->col_column == -1 &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1904 combo_box->priv->row_column == -1 &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1905 last)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1906 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1907 gtk_container_child_get (GTK_CONTAINER (menu),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1908 last,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1909 "right_attach", &current_col,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1910 "top_attach", &current_row,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1911 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1912 if (current_col + cols > combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1913 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1914 current_col = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1915 current_row++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1916 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1917 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1918 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1919 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1920 /* look for a good spot */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1921 while (1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1922 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1923 if (current_col + cols > combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1924 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1925 current_col = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1926 current_row++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1927 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1928
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1929 if (!menu_occupied (GTK_MENU (menu),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1930 current_col, current_col + cols,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1931 current_row, current_row + rows))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1932 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1933
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1934 current_col++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1935 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1936 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1937
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1938 /* set attach props */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1939 gtk_menu_attach (GTK_MENU (menu), item,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1940 current_col, current_col + cols,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1941 current_row, current_row + rows);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1942 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1943
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1944 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1945 gtk_combo_box_relayout (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1946 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1947 GList *list, *j;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1948 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1949
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1950 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1951
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1952 /* do nothing unless we are in menu style and realized */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1953 if (combo_box->priv->tree_view || !GTK_IS_MENU_SHELL (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1954 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1955
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1956 /* get rid of all children */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1957 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1958
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1959 for (j = g_list_last (list); j; j = j->prev)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1960 gtk_container_remove (GTK_CONTAINER (menu), j->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1961
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1962 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1963
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1964 /* and relayout */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1965 gtk_combo_box_menu_fill (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1966 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1967
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1968 /* callbacks */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1969 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1970 gtk_combo_box_menu_button_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1971 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1972 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1973 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1974 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1975
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1976 if (! GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1977 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1978
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1979 if (event->type == GDK_BUTTON_PRESS && event->button == 1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1980 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1981 combo_box->priv->popup_in_progress = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1982
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1983 gtk_menu_set_active (GTK_MENU (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1984 combo_box->priv->active_item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1985
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1986 if (combo_box->priv->wrap_width == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1987 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1988 GtkRequisition requisition;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1989 gint width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1990
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1991 width = GTK_WIDGET (combo_box)->allocation.width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1992 gtk_widget_size_request (combo_box->priv->popup_widget, &requisition);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1993
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1994 gtk_widget_set_size_request (combo_box->priv->popup_widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1995 MAX (width, requisition.width), -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1996 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1997
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1998 gtk_menu_popup (GTK_MENU (combo_box->priv->popup_widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
1999 NULL, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2000 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2001 gtk_combo_box_menu_position,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2002 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2003 NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2004 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2005 combo_box, event->button, event->time);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2006
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2007 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2008 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2009
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2010 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2011 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2012
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2013 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2014 gtk_combo_box_menu_item_activate (GtkWidget *item,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2015 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2016 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2017 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2018 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2019 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2020
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2021 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2022 g_return_if_fail (GTK_IS_MENU (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2023
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2024 index = g_list_index (GTK_MENU_SHELL (menu)->children, item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2025
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2026 gtk_combo_box_set_active (combo_box, index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2027 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2028
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2029 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2030 gtk_combo_box_model_row_inserted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2031 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2032 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2033 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2034 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2035 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2036 gint index = gtk_tree_path_get_indices (path)[0];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2037
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2038 if (combo_box->priv->active_item >= index)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2039 combo_box->priv->active_item++;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2040
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2041 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2042 gtk_combo_box_menu_row_inserted (model, path, iter, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2043 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2044
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2045 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2046 gtk_combo_box_model_row_deleted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2047 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2048 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2049 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2050 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2051 gint index = gtk_tree_path_get_indices (path)[0];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2053 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2054 gtk_combo_box_menu_row_deleted (model, path, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2055
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2056 if (index == combo_box->priv->active_item)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2057 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2058 gint items = gtk_tree_model_iter_n_children (model, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2059
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2060 if (items == 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2061 gtk_combo_box_set_active_internal (combo_box, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2062 else if (index == items)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2063 gtk_combo_box_set_active_internal (combo_box, index - 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2064 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2065 gtk_combo_box_set_active_internal (combo_box, index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2066 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2067 else if (combo_box->priv->active_item > index)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2068 combo_box->priv->active_item--;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2069 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2070
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2071 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2072 gtk_combo_box_model_rows_reordered (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2073 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2074 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2075 gint *new_order,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2076 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2077 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2078 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2079 gint items = gtk_tree_model_iter_n_children (model, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2080 gint i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2081
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2082 for (i = 0; i < items; i++)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2083 if (new_order[i] == combo_box->priv->active_item)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2084 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2085 combo_box->priv->active_item = i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2086 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2087 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2088
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2089 if (!combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2090 gtk_combo_box_menu_rows_reordered (model, path, iter, new_order, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2091 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2092
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2093 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2094 gtk_combo_box_model_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2095 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2096 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2097 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2098 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2099 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2100 gint index = gtk_tree_path_get_indices (path)[0];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2101
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2102 if (index == combo_box->priv->active_item &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2103 combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2104 gtk_widget_queue_resize (GTK_WIDGET (combo_box->priv->cell_view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2106 if (combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2107 gtk_combo_box_list_row_changed (model, path, iter, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2108 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2109 gtk_combo_box_menu_row_changed (model, path, iter, user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2110 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2111
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2112
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2113 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2114 gtk_combo_box_menu_row_inserted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2115 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2116 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2117 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2118 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2119 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2120 GtkWidget *item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2121 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2122
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2123 if (!combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2124 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2125
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2126 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2127 g_return_if_fail (GTK_IS_MENU (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2128
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2129 item = gtk_cell_view_menu_item_new_from_model (model, path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2130 g_signal_connect (item, "activate",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2131 G_CALLBACK (gtk_combo_box_menu_item_activate),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2132 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2133
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2134 cell_view_sync_cells (combo_box, GTK_CELL_VIEW (GTK_BIN (item)->child));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2135
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2136 gtk_menu_shell_insert (GTK_MENU_SHELL (menu), item,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2137 gtk_tree_path_get_indices (path)[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2138 gtk_widget_show (item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2139 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2140
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2141 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2142 gtk_combo_box_menu_row_deleted (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2143 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2144 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2145 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2146 gint index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2147 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2148 GtkWidget *item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2149 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2150
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2151 if (!combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2152 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2153
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2154 index = gtk_tree_path_get_indices (path)[0];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2155
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2156 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2157 g_return_if_fail (GTK_IS_MENU (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2158
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2159 item = g_list_nth_data (GTK_MENU_SHELL (menu)->children, index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2160 g_return_if_fail (GTK_IS_MENU_ITEM (item));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2161
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2162 gtk_container_remove (GTK_CONTAINER (menu), item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2163 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2164
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2165 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2166 gtk_combo_box_menu_rows_reordered (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2167 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2168 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2169 gint *new_order,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2170 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2171 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2172 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2173
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2174 gtk_combo_box_relayout (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2175 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2176
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2177 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2178 gtk_combo_box_menu_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2179 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2180 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2181 gpointer user_data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2182 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2183 GtkComboBox *combo_box = GTK_COMBO_BOX (user_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2184 gint width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2185
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2186 if (!combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2187 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2188
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2189 if (combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2190 gtk_combo_box_relayout_item (combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2191 gtk_tree_path_get_indices (path)[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2192
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2193 width = gtk_combo_box_calc_requested_width (combo_box, path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2194
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2195 if (width > combo_box->priv->width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2196 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2197 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2198 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2199 gtk_widget_set_size_request (combo_box->priv->cell_view, width, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2200 gtk_widget_queue_resize (combo_box->priv->cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2201 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2202 combo_box->priv->width = width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2203 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2204 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2205
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2206 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2207 * list style
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2208 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2209
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2210 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2211 gtk_combo_box_list_setup (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2212 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2213 GSList *i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2214 GtkTreeSelection *sel;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2215
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2216 combo_box->priv->button = gtk_toggle_button_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2217 gtk_widget_set_parent (combo_box->priv->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2218 GTK_BIN (combo_box)->child->parent);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2219 g_signal_connect (combo_box->priv->button, "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2220 G_CALLBACK (gtk_combo_box_list_button_pressed), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2221 g_signal_connect (combo_box->priv->button, "toggled",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2222 G_CALLBACK (gtk_combo_box_button_toggled), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2223 g_signal_connect_after (combo_box, "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2224 G_CALLBACK (gtk_combo_box_key_press), combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2225
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2226 combo_box->priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2227 gtk_container_add (GTK_CONTAINER (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2228 combo_box->priv->arrow);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2229 combo_box->priv->separator = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2230 gtk_widget_show_all (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2231
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2232 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2233 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2234 combo_box->priv->cell_view_frame = gtk_frame_new (NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2235 gtk_widget_set_parent (combo_box->priv->cell_view_frame,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2236 GTK_BIN (combo_box)->child->parent);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2237 gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->cell_view_frame),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2238 GTK_SHADOW_IN);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2240 gtk_cell_view_set_background_color (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2241 &GTK_WIDGET (combo_box)->style->base[GTK_WIDGET_STATE (combo_box)]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2242
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2243 combo_box->priv->box = gtk_event_box_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2244 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2245 gtk_event_box_set_visible_window (GTK_EVENT_BOX (combo_box->priv->box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2246 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2247 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2248
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2249 gtk_container_add (GTK_CONTAINER (combo_box->priv->cell_view_frame),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2250 combo_box->priv->box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2251
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2252 gtk_widget_show_all (combo_box->priv->cell_view_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2253
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2254 g_signal_connect (combo_box->priv->box, "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2255 G_CALLBACK (gtk_combo_box_list_button_pressed),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2256 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2257 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2258
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2259 combo_box->priv->tree_view = gtk_tree_view_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2260 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (combo_box->priv->tree_view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2261 gtk_tree_selection_set_mode (sel, GTK_SELECTION_BROWSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2262 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2263 FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2264 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2265 _gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2266 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2267 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2268 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2269 gtk_tree_view_set_model (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2270 combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2271
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2272 g_signal_connect (combo_box->priv->tree_view, "button_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2273 G_CALLBACK (gtk_combo_box_list_button_pressed),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2274 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2275 g_signal_connect (combo_box->priv->tree_view, "button_release_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2276 G_CALLBACK (gtk_combo_box_list_button_released),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2277 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2278 g_signal_connect (combo_box->priv->tree_view, "key_press_event",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2279 G_CALLBACK (gtk_combo_box_list_key_press),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2280 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2281
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2282 combo_box->priv->column = gtk_tree_view_column_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2283 gtk_tree_view_append_column (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2284 combo_box->priv->column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2285
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2286 /* sync up */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2287 for (i = combo_box->priv->cells; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2288 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2289 GSList *j;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2290 ComboCellInfo *info = (ComboCellInfo *)i->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2291
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2292 if (info->pack == GTK_PACK_START)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2293 gtk_tree_view_column_pack_start (combo_box->priv->column,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2294 info->cell, info->expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2295 else if (info->pack == GTK_PACK_END)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2296 gtk_tree_view_column_pack_end (combo_box->priv->column,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2297 info->cell, info->expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2298
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2299 for (j = info->attributes; j; j = j->next->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2300 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2301 gtk_tree_view_column_add_attribute (combo_box->priv->column,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2302 info->cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2303 j->data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2304 GPOINTER_TO_INT (j->next->data));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2305 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2306 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2307
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2308 if (combo_box->priv->active_item != -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2309 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2310 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2311
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2312 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2313 path = gtk_tree_path_new_from_indices (combo_box->priv->active_item, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2314 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2315 char buf[32];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2316 g_snprintf(buf, sizeof(buf), "%d", combo_box->priv->active_item);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2317 path = gtk_tree_path_new_from_string(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2318 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2319 if (path)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2320 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2321 gtk_tree_view_set_cursor (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2322 path, NULL, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2323 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2324 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2325 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2326
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2327 /* set sample/popup widgets */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2328 gtk_combo_box_set_popup_widget (combo_box, combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2329
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2330 gtk_widget_show (combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2331 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2332
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2333 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2334 gtk_combo_box_list_destroy (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2335 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2336 /* disconnect signals */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2337 g_signal_handlers_disconnect_matched (combo_box->priv->tree_view,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2338 G_SIGNAL_MATCH_DATA,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2339 0, 0, NULL, NULL, combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2340 g_signal_handlers_disconnect_matched (combo_box->priv->button,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2341 G_SIGNAL_MATCH_DATA,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2342 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2343 gtk_combo_box_list_button_pressed,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2344 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2345 if (combo_box->priv->box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2346 g_signal_handlers_disconnect_matched (combo_box->priv->box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2347 G_SIGNAL_MATCH_DATA,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2348 0, 0, NULL,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2349 gtk_combo_box_list_button_pressed,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2350 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2351
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2352 /* destroy things (unparent will kill the latest ref from us)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2353 * last unref on button will destroy the arrow
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2354 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2355 gtk_widget_unparent (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2356 combo_box->priv->button = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2357 combo_box->priv->arrow = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2358
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2359 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2360 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2361 g_object_set (G_OBJECT (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2362 "background_set", FALSE,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2363 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2364 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2365
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2366 if (combo_box->priv->cell_view_frame)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2367 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2368 gtk_widget_unparent (combo_box->priv->cell_view_frame);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2369 combo_box->priv->cell_view_frame = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2370 combo_box->priv->box = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2371 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2372
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2373 gtk_widget_destroy (combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2374
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2375 combo_box->priv->tree_view = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2376 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2377 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2378
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2379 /* callbacks */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2380 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2381 gtk_combo_box_list_remove_grabs (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2382 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2383 if (combo_box->priv->tree_view &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2384 GTK_WIDGET_HAS_GRAB (combo_box->priv->tree_view))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2385 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2386 gtk_grab_remove (combo_box->priv->tree_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2387 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2388
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2389 if (combo_box->priv->popup_window &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2390 GTK_WIDGET_HAS_GRAB (combo_box->priv->popup_window))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2391 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2392 gtk_grab_remove (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2393 gdk_keyboard_ungrab (GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2394 gdk_pointer_ungrab (GDK_CURRENT_TIME);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2395 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2396 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2397
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2398 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2399 gtk_combo_box_list_button_pressed (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2400 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2401 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2402 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2403 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2404
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2405 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2406
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2407 if (ewidget == combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2408 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2409
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2410 if ((ewidget != combo_box->priv->button && ewidget != combo_box->priv->box) ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2411 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (combo_box->priv->button)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2412 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2413
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2414 gtk_combo_box_popup (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2415
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2416 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (combo_box->priv->button),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2417 TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2418
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2419 combo_box->priv->popup_in_progress = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2420
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2421 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2422 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2423
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2424 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2425 gtk_combo_box_list_button_released (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2426 GdkEventButton *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2427 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2428 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2429 gboolean ret;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2430 GtkTreePath *path = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2431
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2432 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2433
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2434 gboolean popup_in_progress = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2436 GtkWidget *ewidget = gtk_get_event_widget ((GdkEvent *)event);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2437
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2438 if (combo_box->priv->popup_in_progress)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2439 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2440 popup_in_progress = TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2441 combo_box->priv->popup_in_progress = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2442 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2443
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2444 if (ewidget != combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2445 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2446 if (ewidget == combo_box->priv->button &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2447 !popup_in_progress &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2448 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (combo_box->priv->button)))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2449 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2450 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2451 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2452 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2453
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2454 /* released outside treeview */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2455 if (ewidget != combo_box->priv->button)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2456 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2457 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2458
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2459 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2460 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2461
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2462 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2463 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2464
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2465 /* select something cool */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2466 ret = gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2467 event->x, event->y,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2468 &path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2469 NULL, NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2470
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2471 if (!ret)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2472 return TRUE; /* clicked outside window? */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2473
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2474 gtk_combo_box_set_active (combo_box, gtk_tree_path_get_indices (path)[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2475 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2476
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2477 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2478
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2479 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2480 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2481
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2482 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2483 gtk_combo_box_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2484 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2485 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2486 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2487 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2488 guint state = event->state & gtk_accelerator_get_default_mod_mask ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2489 gint items = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2490 gint index = gtk_combo_box_get_active (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2491 gint new_index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2492
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2493 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2494 items = gtk_tree_model_iter_n_children (combo_box->priv->model, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2495
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2496 if ((event->keyval == GDK_Down || event->keyval == GDK_KP_Down) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2497 state == GDK_MOD1_MASK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2498 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2499 gtk_combo_box_popup (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2500
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2501 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2502 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2503
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2504 switch (event->keyval)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2505 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2506 case GDK_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2507 case GDK_KP_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2508 new_index = index + 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2509 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2510 case GDK_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2511 case GDK_KP_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2512 new_index = index - 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2513 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2514 case GDK_Page_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2515 case GDK_KP_Page_Up:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2516 case GDK_Home:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2517 case GDK_KP_Home:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2518 new_index = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2519 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2520 case GDK_Page_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2521 case GDK_KP_Page_Down:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2522 case GDK_End:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2523 case GDK_KP_End:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2524 new_index = items - 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2525 break;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2526 default:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2527 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2528 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2529
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2530 if (items > 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2531 gtk_combo_box_set_active (combo_box, CLAMP (new_index, 0, items - 1));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2532
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2533 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2534 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2535
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2536 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2537 gtk_combo_box_menu_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2538 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2539 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2540 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2541 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2542 guint state = event->state & gtk_accelerator_get_default_mod_mask ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2543
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2544 if ((event->keyval == GDK_Up || event->keyval == GDK_KP_Up) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2545 state == GDK_MOD1_MASK)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2546 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2547 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2548
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2549 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2550 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2551
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2552 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2553 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2555 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2556 gtk_combo_box_list_key_press (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2557 GdkEventKey *event,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2558 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2559 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2560 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2561 guint state = event->state & gtk_accelerator_get_default_mod_mask ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2562
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2563 if (event->keyval == GDK_Escape ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2564 ((event->keyval == GDK_Up || event->keyval == GDK_KP_Up) &&
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2565 state == GDK_MOD1_MASK))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2566 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2567 /* reset active item -- this is incredibly lame and ugly */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2568 gtk_combo_box_set_active (combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2569 gtk_combo_box_get_active (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2570
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2571 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2572
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2573 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2574 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2575
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2576 if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2577 event->keyval == GDK_space || event->keyval == GDK_KP_Space)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2578 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2579 gboolean ret = FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2580 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2581 GtkTreeModel *model = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2582
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2583 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2584 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2585 GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (combo_box->priv->tree_view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2586
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2587 ret = gtk_tree_selection_get_selected (sel, &model, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2588 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2589 if (ret)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2590 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2591 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2592
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2593 path = gtk_tree_model_get_path (model, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2594 if (path)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2595 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2596 gtk_combo_box_set_active (combo_box, gtk_tree_path_get_indices (path)[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2597 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2598 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2599 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2600
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2601 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2602
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2603 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2604 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2605
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2606 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2607 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2608
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2609 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2610 gtk_combo_box_list_row_changed (GtkTreeModel *model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2611 GtkTreePath *path,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2612 GtkTreeIter *iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2613 gpointer data)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2614 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2615 GtkComboBox *combo_box = GTK_COMBO_BOX (data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2616 gint width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2617
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2618 width = gtk_combo_box_calc_requested_width (combo_box, path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2619
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2620 if (width > combo_box->priv->width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2621 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2622 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2623 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2624 gtk_widget_set_size_request (combo_box->priv->cell_view, width, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2625 gtk_widget_queue_resize (combo_box->priv->cell_view);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2626 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2627 combo_box->priv->width = width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2628 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2629 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2630
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2631 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2632 * GtkCellLayout implementation
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2633 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2634 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2635 gtk_combo_box_cell_layout_pack_start (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2636 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2637 gboolean expand)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2638 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2639 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2640 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2641 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2642
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2643 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2644 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2645
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2646 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2647
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2648 g_object_ref (G_OBJECT (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2649 gtk_object_sink (GTK_OBJECT (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2650
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2651 info = g_new0 (ComboCellInfo, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2652 info->cell = cell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2653 info->expand = expand;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2654 info->pack = GTK_PACK_START;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2655
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2656 combo_box->priv->cells = g_slist_append (combo_box->priv->cells, info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2657
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2658 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2659 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2660 cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2661
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2662 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2663 gtk_tree_view_column_pack_start (combo_box->priv->column, cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2665 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2666 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2667 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2668 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2669
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2670 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2671 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2672 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2673 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2674
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2675 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2676 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2677 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2678 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2679
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2680 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (view), cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2681 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2682 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2683 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2684 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2685
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2686 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2687 gtk_combo_box_cell_layout_pack_end (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2688 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2689 gboolean expand)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2690 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2691 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2692 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2693 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2694
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2695 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2696 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2697
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2698 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2699
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2700 g_object_ref (G_OBJECT (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2701 gtk_object_sink (GTK_OBJECT (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2702
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2703 info = g_new0 (ComboCellInfo, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2704 info->cell = cell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2705 info->expand = expand;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2706 info->pack = GTK_PACK_END;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2707
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2708 combo_box->priv->cells = g_slist_append (combo_box->priv->cells, info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2709
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2710 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2711 gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2712 cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2713
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2714 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2715 gtk_tree_view_column_pack_end (combo_box->priv->column, cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2716
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2717 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2718 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2719 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2720 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2721
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2722 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2723 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2724 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2725 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2726
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2727 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2728 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2729 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2730 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2731
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2732 gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (view), cell, expand);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2733 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2734 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2735 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2736 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2737
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2738 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2739 gtk_combo_box_cell_layout_clear (GtkCellLayout *layout)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2740 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2741 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2742 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2743 GSList *i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2744
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2745 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2746
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2747 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2748
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2749 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2750 gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo_box->priv->cell_view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2751
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2752 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2753 gtk_tree_view_column_clear (combo_box->priv->column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2754
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2755 for (i = combo_box->priv->cells; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2756 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2757 ComboCellInfo *info = (ComboCellInfo *)i->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2758
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2759 gtk_combo_box_cell_layout_clear_attributes (layout, info->cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2760 g_object_unref (G_OBJECT (info->cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2761 g_free (info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2762 i->data = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2763 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2764 g_slist_free (combo_box->priv->cells);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2765 combo_box->priv->cells = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2766
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2767 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2768 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2769 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2770 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2771
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2772 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2773 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2774 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2775 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2776
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2777 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2778 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2779 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2780 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2781
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2782 gtk_cell_layout_clear (GTK_CELL_LAYOUT (view));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2783 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2784 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2785 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2786 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2787
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2788 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2789 gtk_combo_box_cell_layout_add_attribute (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2790 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2791 const gchar *attribute,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2792 gint column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2793 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2794 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2795 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2796 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2797
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2798 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2799 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2800
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2801 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2802
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2803 info = gtk_combo_box_get_cell_info (combo_box, cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2804
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2805 info->attributes = g_slist_prepend (info->attributes,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2806 GINT_TO_POINTER (column));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2807 info->attributes = g_slist_prepend (info->attributes,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2808 g_strdup (attribute));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2809
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2810 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2811 gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2812 cell, attribute, column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2813
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2814 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2815 gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo_box->priv->column),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2816 cell, attribute, column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2817
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2818 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2819 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2820 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2821 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2822
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2823 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2824 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2825 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2826 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2827
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2828 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2829 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2830 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2831 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2832
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2833 gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (view), cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2834 attribute, column);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2835 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2836 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2837 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2838
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2839 gtk_widget_queue_resize (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2840 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2841
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2842 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2843 gtk_combo_box_cell_layout_set_cell_data_func (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2844 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2845 GtkCellLayoutDataFunc func,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2846 gpointer func_data,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2847 GDestroyNotify destroy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2848 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2849 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2850 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2851 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2852
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2853 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2854
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2855 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2856
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2857 info = gtk_combo_box_get_cell_info (combo_box, cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2858 g_return_if_fail (info != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2859
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2860 if (info->destroy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2861 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2862 GDestroyNotify d = info->destroy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2863
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2864 info->destroy = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2865 d (info->func_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2866 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2867
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2868 info->func = func;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2869 info->func_data = func_data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2870 info->destroy = destroy;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2871
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2872 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2873 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box->priv->cell_view), cell, func, func_data, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2874
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2875 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2876 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo_box->priv->column), cell, func, func_data, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2877
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2878 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2879 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2880 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2881 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2882
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2883 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2884 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2885 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2886 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2887
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2888 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2889 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2890 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2891 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2892
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2893 gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (view), cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2894 func, func_data, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2895 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2896 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2897 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2898
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2899 gtk_widget_queue_resize (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2900 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2901
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2902 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2903 gtk_combo_box_cell_layout_clear_attributes (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2904 GtkCellRenderer *cell)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2905 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2906 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2907 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2908 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2909 GSList *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2910
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2911 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2912 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2913
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2914 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2915
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2916 info = gtk_combo_box_get_cell_info (combo_box, cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2917 if (info)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2918 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2919 list = info->attributes;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2920 while (list && list->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2921 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2922 g_free (list->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2923 list = list->next->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2924 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2925 g_slist_free (info->attributes);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2926 info->attributes = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2927 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2928
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2929 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2930 gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (combo_box->priv->cell_view), cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2931
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2932 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2933 gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (combo_box->priv->column), cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2934
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2935 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2936 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2937 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2938 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2939
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2940 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2941 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2942 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2943 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2944
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2945 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2946 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2947 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2948 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2949
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2950 gtk_cell_layout_clear_attributes (GTK_CELL_LAYOUT (view), cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2951 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2952 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2953 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2954
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2955 gtk_widget_queue_resize (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2956 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2957
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2958 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2959 gtk_combo_box_cell_layout_reorder (GtkCellLayout *layout,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2960 GtkCellRenderer *cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2961 gint position)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2962 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2963 ComboCellInfo *info;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2964 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2965 GtkWidget *menu;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2966 GSList *link;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2967
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2968 g_return_if_fail (GTK_IS_COMBO_BOX (layout));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2969 g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2970
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2971 combo_box = GTK_COMBO_BOX (layout);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2972
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2973 info = gtk_combo_box_get_cell_info (combo_box, cell);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2974
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2975 g_return_if_fail (info != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2976 g_return_if_fail (position >= 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2977
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2978 link = g_slist_find (combo_box->priv->cells, info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2979
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2980 g_return_if_fail (link != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2981
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2982 combo_box->priv->cells = g_slist_remove_link (combo_box->priv->cells, link);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2983 combo_box->priv->cells = g_slist_insert (combo_box->priv->cells, info,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2984 position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2985
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2986 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2987 gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2988 cell, position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2989
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2990 if (combo_box->priv->column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2991 gtk_cell_layout_reorder (GTK_CELL_LAYOUT (combo_box->priv->column),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2992 cell, position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2993
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2994 menu = combo_box->priv->popup_widget;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2995 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2996 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2997 GList *i, *list;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2998
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
2999 list = gtk_container_get_children (GTK_CONTAINER (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3000 for (i = list; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3001 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3002 GtkCellView *view;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3003
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3004 if (GTK_IS_CELL_VIEW_MENU_ITEM (i->data))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3005 view = GTK_CELL_VIEW (GTK_BIN (i->data)->child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3006 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3007 view = GTK_CELL_VIEW (i->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3008
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3009 gtk_cell_layout_reorder (GTK_CELL_LAYOUT (view), cell, position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3010 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3011 g_list_free (list);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3012 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3013
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3014 gtk_widget_queue_draw (GTK_WIDGET (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3015 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3016
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3017 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3018 * public API
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3019 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3020
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3021 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3022 * gtk_combo_box_new:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3023 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3024 * Creates a new empty #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3025 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3026 * Return value: A new #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3027 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3028 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3029 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3030 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3031 gtk_combo_box_new (void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3032 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3033 return GTK_WIDGET (g_object_new (GTK_TYPE_COMBO_BOX, NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3034 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3035
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3036 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3037 * gtk_combo_box_new_with_model:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3038 * @model: A #GtkTreeModel.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3039 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3040 * Creates a new #GtkComboBox with the model initialized to @model.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3041 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3042 * Return value: A new #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3043 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3044 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3045 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3046 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3047 gtk_combo_box_new_with_model (GtkTreeModel *model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3048 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3049 GtkComboBox *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3050
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3051 g_return_val_if_fail (GTK_IS_TREE_MODEL (model), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3052
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3053 combo_box = GTK_COMBO_BOX (g_object_new (GTK_TYPE_COMBO_BOX,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3054 "model", model,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3055 NULL));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3056
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3057 return GTK_WIDGET (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3058 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3059
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3060 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3061 * gtk_combo_box_set_wrap_width:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3062 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3063 * @width: Preferred number of columns.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3064 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3065 * Sets the wrap width of @combo_box to be @width. The wrap width is basically
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3066 * the preferred number of columns when you want to the popup to be layed out
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3067 * in a table.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3068 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3069 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3070 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3071 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3072 gtk_combo_box_set_wrap_width (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3073 gint width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3074 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3075 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3076 g_return_if_fail (width >= 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3077
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3078 if (width != combo_box->priv->wrap_width)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3079 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3080 combo_box->priv->wrap_width = width;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3081
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3082 gtk_combo_box_check_appearance (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3083 gtk_combo_box_relayout (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3084
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3085 g_object_notify (G_OBJECT (combo_box), "wrap_width");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3086 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3087 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3088
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3089 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3090 * gtk_combo_box_set_row_span_column:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3091 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3092 * @row_span: A column in the model passed during construction.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3093 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3094 * Sets the column with row span information for @combo_box to be @row_span.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3095 * The row span column contains integers which indicate how many rows
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3096 * an item should span.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3097 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3098 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3099 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3100 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3101 gtk_combo_box_set_row_span_column (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3102 gint row_span)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3103 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3104 gint col;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3105
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3106 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3107
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3108 col = gtk_tree_model_get_n_columns (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3109 g_return_if_fail (row_span >= 0 && row_span < col);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3110
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3111 if (row_span != combo_box->priv->row_column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3112 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3113 combo_box->priv->row_column = row_span;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3114
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3115 gtk_combo_box_relayout (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3116
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3117 g_object_notify (G_OBJECT (combo_box), "row_span_column");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3118 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3119 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3120
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3121 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3122 * gtk_combo_box_set_column_span_column:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3123 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3124 * @column_span: A column in the model passed during construction.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3125 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3126 * Sets the column with column span information for @combo_box to be
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3127 * @column_span. The column span column contains integers which indicate
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3128 * how many columns an item should span.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3129 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3130 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3131 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3132 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3133 gtk_combo_box_set_column_span_column (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3134 gint column_span)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3135 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3136 gint col;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3137
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3138 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3139
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3140 col = gtk_tree_model_get_n_columns (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3141 g_return_if_fail (column_span >= 0 && column_span < col);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3142
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3143 if (column_span != combo_box->priv->col_column)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3144 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3145 combo_box->priv->col_column = column_span;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3146
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3147 gtk_combo_box_relayout (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3148
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3149 g_object_notify (G_OBJECT (combo_box), "column_span_column");
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3150 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3151 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3152
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3153 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3154 * gtk_combo_box_get_active:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3155 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3156 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3157 * Returns the index of the currently active item, or -1 if there's no
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3158 * active item.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3159 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3160 * Return value: An integer which is the index of the currently active item, or
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3161 * -1 if there's no active item.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3162 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3163 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3164 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3165 gint
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3166 gtk_combo_box_get_active (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3167 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3168 g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3169
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3170 return combo_box->priv->active_item;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3171 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3172
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3173 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3174 * gtk_combo_box_set_active:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3175 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3176 * @index_: An index in the model passed during construction, or -1 to have
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3177 * no active item.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3178 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3179 * Sets the active item of @combo_box to be the item at @index.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3180 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3181 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3182 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3183 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3184 gtk_combo_box_set_active (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3185 gint index_)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3186 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3187 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3188 /* -1 means "no item selected" */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3189 g_return_if_fail (index_ >= -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3190
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3191 if (combo_box->priv->active_item == index_)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3192 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3193
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3194 gtk_combo_box_set_active_internal (combo_box, index_);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3195 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3196
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3197 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3198 gtk_combo_box_set_active_internal (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3199 gint index)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3200 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3201 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3202
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3203 combo_box->priv->active_item = index;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3204
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3205 if (index == -1)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3206 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3207 if (combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3208 gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (combo_box->priv->tree_view)));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3209 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3210 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3211 GtkMenu *menu = GTK_MENU (combo_box->priv->popup_widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3212
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3213 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3214 gtk_menu_set_active (menu, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3215 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3216
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3217 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3218 gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->cell_view), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3219 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3220 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3221 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3222 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3223 path = gtk_tree_path_new_from_indices (index, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3224 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3225 char buf[32];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3226 g_snprintf(buf, sizeof(buf), "%d", index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3227 path = gtk_tree_path_new_from_string(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3228 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3229
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3230 if (combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3231 gtk_tree_view_set_cursor (GTK_TREE_VIEW (combo_box->priv->tree_view), path, NULL, FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3232 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3233 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3234 GtkMenu *menu = GTK_MENU (combo_box->priv->popup_widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3235
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3236 if (GTK_IS_MENU (menu))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3237 gtk_menu_set_active (GTK_MENU (menu), index);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3238 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3239
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3240 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3241 gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (combo_box->priv->cell_view), path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3242
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3243 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3244 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3245
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3246 g_signal_emit_by_name (combo_box, "changed", NULL, NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3247 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3248
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3249
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3250 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3251 * gtk_combo_box_get_active_iter:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3252 * @combo_box: A #GtkComboBox
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3253 * @iter: The uninitialized #GtkTreeIter.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3254 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3255 * Sets @iter to point to the current active item, if it exists.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3256 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3257 * Return value: %TRUE, if @iter was set
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3258 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3259 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3260 **/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3261 gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3262 gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3263 GtkTreeIter *iter)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3264 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3265 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3266 gint active;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3267 gboolean retval;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3268 #if !GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3269 char buf[32];
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3270 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3271
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3272 g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), FALSE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3273
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3274 active = gtk_combo_box_get_active (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3275 if (active < 0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3276 return FALSE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3277
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3278 #if GTK_CHECK_VERSION(2,2,0)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3279 path = gtk_tree_path_new_from_indices (active, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3280 #else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3281 g_snprintf(buf, sizeof(buf), "%d", active);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3282 path = gtk_tree_path_new_from_string(buf);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3283 #endif
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3284 retval = gtk_tree_model_get_iter (gtk_combo_box_get_model (combo_box),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3285 iter, path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3286 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3287
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3288 return retval;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3289 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3290
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3291 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3292 * gtk_combo_box_set_active_iter:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3293 * @combo_box: A #GtkComboBox
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3294 * @iter: The #GtkTreeIter.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3295 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3296 * Sets the current active item to be the one referenced by @iter.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3297 * @iter must correspond to a path of depth one.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3298 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3299 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3300 **/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3301 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3302 gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3303 GtkTreeIter *iter)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3304 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3305 GtkTreePath *path;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3306
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3307 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3308
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3309 path = gtk_tree_model_get_path (gtk_combo_box_get_model (combo_box), iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3310 g_return_if_fail (path != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3311 g_return_if_fail (gtk_tree_path_get_depth (path) == 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3312
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3313 gtk_combo_box_set_active (combo_box, gtk_tree_path_get_indices (path)[0]);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3314 gtk_tree_path_free (path);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3315 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3316
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3317 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3318 * gtk_combo_box_set_model:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3319 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3320 * @model: A #GtkTreeModel.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3321 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3322 * Sets the model used by @combo_box to be @model. Will unset a previously set
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3323 * model (if applicable). If @model is %NULL, then it will unset the model.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3324 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3325 * Note that this function does not clear the cell renderers, you have to
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3326 * call gtk_combo_box_cell_layout_clear() yourself if you need to set up
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3327 * different cell renderers for the new model.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3328 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3329 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3330 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3331 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3332 gtk_combo_box_set_model (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3333 GtkTreeModel *model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3334 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3335 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3336
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3337 if (!model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3338 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3339 gtk_combo_box_unset_model (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3340 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3341 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3342
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3343 g_return_if_fail (GTK_IS_TREE_MODEL (model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3344
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3345 if (model == combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3346 return;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3347
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3348 if (combo_box->priv->model)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3349 gtk_combo_box_unset_model (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3350
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3351 combo_box->priv->model = model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3352 g_object_ref (G_OBJECT (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3353
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3354 combo_box->priv->inserted_id =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3355 g_signal_connect (combo_box->priv->model, "row_inserted",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3356 G_CALLBACK (gtk_combo_box_model_row_inserted),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3357 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3358 combo_box->priv->deleted_id =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3359 g_signal_connect (combo_box->priv->model, "row_deleted",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3360 G_CALLBACK (gtk_combo_box_model_row_deleted),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3361 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3362 combo_box->priv->reordered_id =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3363 g_signal_connect (combo_box->priv->model, "rows_reordered",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3364 G_CALLBACK (gtk_combo_box_model_rows_reordered),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3365 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3366 combo_box->priv->changed_id =
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3367 g_signal_connect (combo_box->priv->model, "row_changed",
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3368 G_CALLBACK (gtk_combo_box_model_row_changed),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3369 combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3370
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3371 if (combo_box->priv->tree_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3372 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3373 /* list mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3374 gtk_tree_view_set_model (GTK_TREE_VIEW (combo_box->priv->tree_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3375 combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3376 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3377 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3378 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3379 /* menu mode */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3380 if (combo_box->priv->popup_widget)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3381 gtk_combo_box_menu_fill (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3382
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3383 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3384
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3385 if (combo_box->priv->cell_view)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3386 gtk_cell_view_set_model (GTK_CELL_VIEW (combo_box->priv->cell_view),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3387 combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3388 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3389
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3390 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3391 * gtk_combo_box_get_model
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3392 * @combo_box: A #GtkComboBox.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3393 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3394 * Returns the #GtkTreeModel which is acting as data source for @combo_box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3395 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3396 * Return value: A #GtkTreeModel which was passed during construction.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3397 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3398 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3399 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3400 GtkTreeModel *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3401 gtk_combo_box_get_model (GtkComboBox *combo_box)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3402 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3403 g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3404
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3405 return combo_box->priv->model;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3406 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3407
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3408
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3409 /* convenience API for simple text combos */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3410
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3411 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3412 * gtk_combo_box_new_text:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3413 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3414 * Convenience function which constructs a new text combo box, which is a
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3415 * #GtkComboBox just displaying strings. If you use this function to create
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3416 * a text combo box, you should only manipulate its data source with the
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3417 * following convenience functions: gtk_combo_box_append_text(),
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3418 * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text() and
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3419 * gtk_combo_box_remove_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3420 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3421 * Return value: A new text combo box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3422 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3423 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3424 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3425 GtkWidget *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3426 gtk_combo_box_new_text (void)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3427 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3428 GtkWidget *combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3429 GtkCellRenderer *cell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3430 GtkListStore *store;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3431
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3432 store = gtk_list_store_new (1, G_TYPE_STRING);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3433 combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3434 g_object_unref (store);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3435
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3436 cell = gtk_cell_renderer_text_new ();
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3437 gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3438 gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3439 "text", 0,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3440 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3441
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3442 return combo_box;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3443 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3444
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3445 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3446 * gtk_combo_box_append_text:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3447 * @combo_box: A #GtkComboBox constructed using gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3448 * @text: A string.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3449 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3450 * Appends @string to the list of strings stored in @combo_box. Note that
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3451 * you can only use this function with combo boxes constructed with
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3452 * gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3453 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3454 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3455 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3456 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3457 gtk_combo_box_append_text (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3458 const gchar *text)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3459 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3460 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3461 GtkListStore *store;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3462
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3463 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3464 g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3465 g_return_if_fail (text != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3466
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3467 store = GTK_LIST_STORE (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3468
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3469 gtk_list_store_append (store, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3470 gtk_list_store_set (store, &iter, 0, text, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3471 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3472
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3473 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3474 * gtk_combo_box_insert_text:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3475 * @combo_box: A #GtkComboBox constructed using gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3476 * @position: An index to insert @text.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3477 * @text: A string.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3478 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3479 * Inserts @string at @position in the list of strings stored in @combo_box.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3480 * Note that you can only use this function with combo boxes constructed
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3481 * with gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3482 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3483 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3484 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3485 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3486 gtk_combo_box_insert_text (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3487 gint position,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3488 const gchar *text)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3489 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3490 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3491 GtkListStore *store;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3492
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3493 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3494 g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3495 g_return_if_fail (position >= 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3496 g_return_if_fail (text != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3497
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3498 store = GTK_LIST_STORE (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3499
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3500 gtk_list_store_insert (store, &iter, position);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3501 gtk_list_store_set (store, &iter, 0, text, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3502 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3503
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3504 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3505 * gtk_combo_box_prepend_text:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3506 * @combo_box: A #GtkComboBox constructed with gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3507 * @text: A string.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3508 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3509 * Prepends @string to the list of strings stored in @combo_box. Note that
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3510 * you can only use this function with combo boxes constructed with
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3511 * gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3512 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3513 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3514 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3515 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3516 gtk_combo_box_prepend_text (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3517 const gchar *text)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3518 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3519 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3520 GtkListStore *store;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3521
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3522 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3523 g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3524 g_return_if_fail (text != NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3525
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3526 store = GTK_LIST_STORE (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3527
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3528 gtk_list_store_prepend (store, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3529 gtk_list_store_set (store, &iter, 0, text, -1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3530 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3531
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3532 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3533 * gtk_combo_box_remove_text:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3534 * @combo_box: A #GtkComboBox constructed with gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3535 * @position: Index of the item to remove.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3536 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3537 * Removes the string at @position from @combo_box. Note that you can only use
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3538 * this function with combo boxes constructed with gtk_combo_box_new_text().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3539 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3540 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3541 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3542 void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3543 gtk_combo_box_remove_text (GtkComboBox *combo_box,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3544 gint position)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3545 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3546 GtkTreeIter iter;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3547 GtkListStore *store;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3548
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3549 g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3550 g_return_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3551 g_return_if_fail (position >= 0);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3552
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3553 store = GTK_LIST_STORE (combo_box->priv->model);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3554
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3555 if (gtk_tree_model_iter_nth_child (combo_box->priv->model, &iter,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3556 NULL, position))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3557 gtk_list_store_remove (store, &iter);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3558 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3559
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3560
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3561 static gboolean
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3562 gtk_combo_box_mnemonic_activate (GtkWidget *widget,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3563 gboolean group_cycling)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3564 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3565 GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3566
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3567 gtk_widget_grab_focus (combo_box->priv->button);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3568
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3569 return TRUE;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3570 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3571
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3572 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3573 gtk_combo_box_destroy (GtkObject *object)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3574 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3575 GtkComboBox *combo_box = GTK_COMBO_BOX (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3576
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3577 gtk_combo_box_popdown (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3578
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3579 combo_box->priv->destroying = 1;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3580
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3581 GTK_OBJECT_CLASS (parent_class)->destroy (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3582 combo_box->priv->cell_view = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3583
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3584 combo_box->priv->destroying = 0;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3585 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3586
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3587 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3588 gtk_combo_box_finalize (GObject *object)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3589 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3590 GtkComboBox *combo_box = GTK_COMBO_BOX (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3591 GSList *i;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3592
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3593 if (GTK_IS_MENU (combo_box->priv->popup_widget))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3594 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3595 gtk_combo_box_menu_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3596 gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3597 combo_box->priv->popup_widget = NULL;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3598 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3599
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3600 if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view))
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3601 gtk_combo_box_list_destroy (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3602
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3603 if (combo_box->priv->popup_window)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3604 gtk_widget_destroy (combo_box->priv->popup_window);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3605
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3606 gtk_combo_box_unset_model (combo_box);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3607
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3608 for (i = combo_box->priv->cells; i; i = i->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3609 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3610 ComboCellInfo *info = (ComboCellInfo *)i->data;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3611 GSList *list = info->attributes;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3612
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3613 if (info->destroy)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3614 info->destroy (info->func_data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3615
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3616 while (list && list->next)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3617 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3618 g_free (list->data);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3619 list = list->next->next;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3620 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3621 g_slist_free (info->attributes);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3622
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3623 g_object_unref (G_OBJECT (info->cell));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3624 g_free (info);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3625 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3626 g_slist_free (combo_box->priv->cells);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3627
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3628 g_free (combo_box->priv);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3629
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3630 G_OBJECT_CLASS (parent_class)->finalize (object);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3631 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3632
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3633
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3634 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3635 * Code below this point has been pulled in from gtkmenu.c in 2.4.14
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3636 * and is needed to provide gtk_menu_attach()
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3637 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3638
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3639 typedef struct
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3640 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3641 gint left_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3642 gint right_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3643 gint top_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3644 gint bottom_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3645 gint effective_left_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3646 gint effective_right_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3647 gint effective_top_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3648 gint effective_bottom_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3649 } AttachInfo;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3650
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3651 #define ATTACH_INFO_KEY "gtk-menu-child-attach-info-key"
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3652
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3653 static AttachInfo *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3654 get_attach_info (GtkWidget *child)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3655 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3656 GObject *object = G_OBJECT (child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3657 AttachInfo *ai = g_object_get_data (object, ATTACH_INFO_KEY);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3658
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3659 if (!ai)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3660 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3661 ai = g_new0 (AttachInfo, 1);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3662 g_object_set_data_full (object, ATTACH_INFO_KEY, ai, g_free);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3663 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3664
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3665 return ai;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3666 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3667
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3668 /**
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3669 * gtk_menu_attach:
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3670 * @menu: a #GtkMenu.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3671 * @child: a #GtkMenuItem.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3672 * @left_attach: The column number to attach the left side of the item to.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3673 * @right_attach: The column number to attach the right side of the item to.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3674 * @top_attach: The row number to attach the top of the item to.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3675 * @bottom_attach: The row number to attach the bottom of the item to.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3676 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3677 * Adds a new #GtkMenuItem to a (table) menu. The number of 'cells' that
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3678 * an item will occupy is specified by @left_attach, @right_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3679 * @top_attach and @bottom_attach. These each represent the leftmost,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3680 * rightmost, uppermost and lower column and row numbers of the table.
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3681 * (Columns and rows are indexed from zero).
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3682 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3683 * Note that this function is not related to gtk_menu_detach().
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3684 *
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3685 * Since: 2.4
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3686 **/
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3687 static void
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3688 gtk_menu_attach (GtkMenu *menu,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3689 GtkWidget *child,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3690 guint left_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3691 guint right_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3692 guint top_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3693 guint bottom_attach)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3694 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3695 GtkMenuShell *menu_shell;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3696
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3697 g_return_if_fail (GTK_IS_MENU (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3698 g_return_if_fail (GTK_IS_MENU_ITEM (child));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3699 g_return_if_fail (child->parent == NULL ||
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3700 child->parent == GTK_WIDGET (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3701 g_return_if_fail (left_attach < right_attach);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3702 g_return_if_fail (top_attach < bottom_attach);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3703
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3704 menu_shell = GTK_MENU_SHELL (menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3705
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3706 if (!child->parent)
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3707 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3708 AttachInfo *ai = get_attach_info (child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3709
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3710 ai->left_attach = left_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3711 ai->right_attach = right_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3712 ai->top_attach = top_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3713 ai->bottom_attach = bottom_attach;
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3714
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3715 menu_shell->children = g_list_append (menu_shell->children, child);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3716
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3717 gtk_widget_set_parent (child, GTK_WIDGET (menu));
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3718
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3719 /*
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3720 menu_queue_resize (menu);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3721 */
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3722 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3723 else
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3724 {
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3725 gtk_container_child_set (GTK_CONTAINER (child->parent), child,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3726 "left_attach", left_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3727 "right_attach", right_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3728 "top_attach", top_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3729 "bottom_attach", bottom_attach,
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3730 NULL);
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3731 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3732 }
009db0b357b5 This is a hand-crafted commit to migrate across subversion revisions
Ethan Blanton <elb@pidgin.im>
parents:
diff changeset
3733 #endif /* Gtk 2.4 */