File: | cafe-panel/panel-properties-dialog.c |
Warning: | line 933, column 2 Value stored to 'dialog' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * panel-properties-dialog.c: |
3 | * |
4 | * Copyright (C) 2003 Sun Microsystems, Inc. |
5 | * |
6 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as |
8 | * published by the Free Software Foundation; either version 2 of the |
9 | * License, or (at your option) any later version. |
10 | * |
11 | * This program is distributed in the hope that it will be useful, but |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
19 | * 02110-1301, USA. |
20 | |
21 | * Authors: |
22 | * Mark McLoughlin <mark@skynet.ie> |
23 | */ |
24 | |
25 | #include <config.h> |
26 | |
27 | #include "panel-properties-dialog.h" |
28 | |
29 | #include <string.h> |
30 | #include <glib/gi18n.h> |
31 | #include <gio/gio.h> |
32 | |
33 | #include <libpanel-util/panel-glib.h> |
34 | #include <libpanel-util/panel-ctk.h> |
35 | #include <libpanel-util/panel-icon-chooser.h> |
36 | #include <libpanel-util/panel-show.h> |
37 | |
38 | #include "panel-profile.h" |
39 | #include "panel-schemas.h" |
40 | #include "panel-util.h" |
41 | #include "panel-globals.h" |
42 | #include "panel-icon-names.h" |
43 | |
44 | typedef struct { |
45 | PanelToplevel *toplevel; |
46 | GSettings *settings; |
47 | GSettings *background_settings; |
48 | |
49 | CtkWidget *properties_dialog; |
50 | |
51 | CtkWidget *general_table; |
52 | CtkWidget *general_vbox; |
53 | CtkWidget *orientation_combo; |
54 | CtkWidget *orientation_label; |
55 | CtkWidget *size_widgets; |
56 | CtkWidget *size_spin; |
57 | CtkWidget *size_label; |
58 | CtkWidget *size_label_pixels; |
59 | CtkWidget *icon_align; |
60 | CtkWidget *icon_chooser; |
61 | CtkWidget *icon_label; |
62 | CtkWidget *expand_toggle; |
63 | CtkWidget *autohide_toggle; |
64 | CtkWidget *hidebuttons_toggle; |
65 | CtkWidget *arrows_toggle; |
66 | CtkWidget *default_radio; |
67 | CtkWidget *color_radio; |
68 | CtkWidget *image_radio; |
69 | CtkWidget *color_widgets; |
70 | CtkWidget *image_widgets; |
71 | CtkWidget *color_button; |
72 | CtkWidget *color_label; |
73 | CtkWidget *image_chooser; |
74 | CtkWidget *opacity_scale; |
75 | CtkWidget *opacity_label; |
76 | CtkWidget *opacity_legend; |
77 | |
78 | CtkWidget *writability_warn_general; |
79 | CtkWidget *writability_warn_background; |
80 | |
81 | /* FIXME: This is a workaround for CTK+ bug #327243 */ |
82 | int selection_emitted; |
83 | } PanelPropertiesDialog; |
84 | |
85 | static GQuark panel_properties_dialog_quark = 0; |
86 | |
87 | static void panel_properties_dialog_opacity_changed (PanelPropertiesDialog *dialog); |
88 | |
89 | static void |
90 | panel_properties_dialog_free (PanelPropertiesDialog *dialog) |
91 | { |
92 | if (dialog->settings) |
93 | g_object_unref (dialog->settings); |
94 | dialog->settings = NULL((void*)0); |
95 | |
96 | if (dialog->background_settings) |
97 | g_object_unref (dialog->background_settings); |
98 | dialog->background_settings = NULL((void*)0); |
99 | |
100 | if (dialog->properties_dialog) |
101 | ctk_widget_destroy (dialog->properties_dialog); |
102 | dialog->properties_dialog = NULL((void*)0); |
103 | |
104 | g_free (dialog); |
105 | } |
106 | |
107 | enum { |
108 | COLUMN_TEXT, |
109 | COLUMN_ITEM, |
110 | NUMBER_COLUMNS |
111 | }; |
112 | |
113 | typedef struct { |
114 | const char *name; |
115 | PanelOrientation orientation; |
116 | } OrientationComboItem; |
117 | |
118 | static OrientationComboItem orientation_items [] = { |
119 | { NC_("Orientation", "Top")("Top"), PANEL_ORIENTATION_TOP }, |
120 | { NC_("Orientation", "Bottom")("Bottom"), PANEL_ORIENTATION_BOTTOM }, |
121 | { NC_("Orientation", "Left")("Left"), PANEL_ORIENTATION_LEFT }, |
122 | { NC_("Orientation", "Right")("Right"), PANEL_ORIENTATION_RIGHT } |
123 | }; |
124 | |
125 | static void |
126 | panel_properties_dialog_orientation_changed (PanelPropertiesDialog *dialog, |
127 | CtkComboBox *combo_box) |
128 | { |
129 | CtkTreeIter iter; |
130 | CtkTreeModel *model; |
131 | OrientationComboItem *item; |
132 | |
133 | g_assert (dialog->orientation_combo == CTK_WIDGET (combo_box))do { if (dialog->orientation_combo == ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((combo_box) ), ((ctk_widget_get_type ()))))))) ; else g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c", 133, ((const char *) (__func__)), "dialog->orientation_combo == CTK_WIDGET (combo_box)" ); } while (0); |
134 | |
135 | if (!ctk_combo_box_get_active_iter (combo_box, &iter)) |
136 | return; |
137 | |
138 | model = ctk_combo_box_get_model (combo_box); |
139 | ctk_tree_model_get (model, &iter, COLUMN_ITEM, &item, -1); |
140 | if (item == NULL((void*)0)) |
141 | return; |
142 | |
143 | panel_profile_set_toplevel_orientation (dialog->toplevel, |
144 | item->orientation); |
145 | } |
146 | |
147 | static void |
148 | panel_properties_dialog_setup_orientation_combo_sensitivty (PanelPropertiesDialog *dialog, CtkToggleButton *n) |
149 | { |
150 | gboolean expand; |
151 | expand = panel_profile_get_toplevel_expand (dialog->toplevel); |
152 | |
153 | if (! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ORIENTATION_KEY"orientation")) { |
154 | ctk_widget_set_sensitive (dialog->orientation_combo, FALSE(0)); |
155 | ctk_widget_set_sensitive (dialog->orientation_label, FALSE(0)); |
156 | ctk_widget_show (dialog->writability_warn_general); |
157 | } |
158 | else { |
159 | /* enable orientation only for non-expanded panels */ |
160 | ctk_widget_set_sensitive (dialog->orientation_combo, expand); |
161 | ctk_widget_set_sensitive (dialog->orientation_label, expand); |
162 | } |
163 | } |
164 | |
165 | static void |
166 | panel_properties_dialog_setup_orientation_combo (PanelPropertiesDialog *dialog, |
167 | CtkBuilder *gui) |
168 | { |
169 | PanelOrientation orientation; |
170 | CtkListStore *model; |
171 | CtkTreeIter iter; |
172 | CtkCellRenderer *renderer; |
173 | int i; |
174 | |
175 | dialog->orientation_combo = PANEL_CTK_BUILDER_GET (gui, "orientation_combo")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "orientation_combo"))), ((ctk_widget_get_type ())))))); |
176 | g_return_if_fail (dialog->orientation_combo != NULL)do { if ((dialog->orientation_combo != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->orientation_combo != NULL"); return; } } while (0); |
177 | dialog->orientation_label = PANEL_CTK_BUILDER_GET (gui, "orientation_label")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "orientation_label"))), ((ctk_widget_get_type ())))))); |
178 | g_return_if_fail (dialog->orientation_label != NULL)do { if ((dialog->orientation_label != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->orientation_label != NULL"); return; } } while (0); |
179 | |
180 | orientation = panel_profile_get_toplevel_orientation (dialog->toplevel); |
181 | |
182 | model = ctk_list_store_new (NUMBER_COLUMNS, |
183 | G_TYPE_STRING((GType) ((16) << (2))), |
184 | G_TYPE_POINTER((GType) ((17) << (2)))); |
185 | |
186 | ctk_combo_box_set_model (CTK_COMBO_BOX (dialog->orientation_combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_combo_box_get_type ())))))), |
187 | CTK_TREE_MODEL (model)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_model_get_type ()))))))); |
188 | |
189 | for (i = 0; i < G_N_ELEMENTS (orientation_items)(sizeof (orientation_items) / sizeof ((orientation_items)[0]) ); i++) { |
190 | ctk_list_store_append (model, &iter); |
191 | ctk_list_store_set (model, &iter, |
192 | COLUMN_TEXT, g_dpgettext2 (NULL((void*)0), "Orientation", orientation_items [i].name), |
193 | COLUMN_ITEM, &(orientation_items [i]), |
194 | -1); |
195 | if (orientation == orientation_items [i].orientation) |
196 | ctk_combo_box_set_active_iter (CTK_COMBO_BOX (dialog->orientation_combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_combo_box_get_type ())))))), |
197 | &iter); |
198 | } |
199 | |
200 | renderer = ctk_cell_renderer_text_new (); |
201 | ctk_cell_layout_pack_start (CTK_CELL_LAYOUT (dialog->orientation_combo)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_cell_layout_get_type ())))))), |
202 | renderer, TRUE(!(0))); |
203 | ctk_cell_layout_set_attributes (CTK_CELL_LAYOUT (dialog->orientation_combo)((((CtkCellLayout*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_cell_layout_get_type ())))))), |
204 | renderer, "text", COLUMN_TEXT, NULL((void*)0)); |
205 | |
206 | g_signal_connect_swapped (dialog->orientation_combo, "changed",g_signal_connect_data ((dialog->orientation_combo), ("changed" ), (((GCallback) (panel_properties_dialog_orientation_changed ))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
207 | G_CALLBACK (panel_properties_dialog_orientation_changed),g_signal_connect_data ((dialog->orientation_combo), ("changed" ), (((GCallback) (panel_properties_dialog_orientation_changed ))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
208 | dialog)g_signal_connect_data ((dialog->orientation_combo), ("changed" ), (((GCallback) (panel_properties_dialog_orientation_changed ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
209 | |
210 | panel_properties_dialog_setup_orientation_combo_sensitivty (dialog, NULL((void*)0)); |
211 | } |
212 | |
213 | static void |
214 | panel_properties_dialog_size_changed (PanelPropertiesDialog *dialog, |
215 | CtkSpinButton *spin_button) |
216 | { |
217 | panel_profile_set_toplevel_size (dialog->toplevel, |
218 | ctk_spin_button_get_value_as_int (spin_button)); |
219 | } |
220 | |
221 | static void |
222 | panel_properties_dialog_setup_size_spin (PanelPropertiesDialog *dialog, |
223 | CtkBuilder *gui) |
224 | { |
225 | dialog->size_widgets = PANEL_CTK_BUILDER_GET (gui, "size_widgets")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "size_widgets"))), ((ctk_widget_get_type ())))))); |
226 | g_return_if_fail (dialog->size_widgets != NULL)do { if ((dialog->size_widgets != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->size_widgets != NULL" ); return; } } while (0); |
227 | dialog->size_spin = PANEL_CTK_BUILDER_GET (gui, "size_spin")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "size_spin"))), ((ctk_widget_get_type ())))))); |
228 | g_return_if_fail (dialog->size_spin != NULL)do { if ((dialog->size_spin != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->size_spin != NULL" ); return; } } while (0); |
229 | dialog->size_label = PANEL_CTK_BUILDER_GET (gui, "size_label")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "size_label"))), ((ctk_widget_get_type ())))))); |
230 | g_return_if_fail (dialog->size_label != NULL)do { if ((dialog->size_label != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->size_label != NULL" ); return; } } while (0); |
231 | dialog->size_label_pixels = PANEL_CTK_BUILDER_GET (gui, "size_label_pixels")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "size_label_pixels"))), ((ctk_widget_get_type ())))))); |
232 | g_return_if_fail (dialog->size_label_pixels != NULL)do { if ((dialog->size_label_pixels != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->size_label_pixels != NULL"); return; } } while (0); |
233 | |
234 | ctk_spin_button_set_range (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), |
235 | panel_toplevel_get_minimum_size (dialog->toplevel), |
236 | panel_toplevel_get_maximum_size (dialog->toplevel)); |
237 | |
238 | ctk_spin_button_set_value (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), |
239 | panel_profile_get_toplevel_size (dialog->toplevel)); |
240 | |
241 | g_signal_connect_swapped (dialog->size_spin, "value_changed",g_signal_connect_data ((dialog->size_spin), ("value_changed" ), (((GCallback) (panel_properties_dialog_size_changed))), (dialog ), ((void*)0), G_CONNECT_SWAPPED) |
242 | G_CALLBACK (panel_properties_dialog_size_changed),g_signal_connect_data ((dialog->size_spin), ("value_changed" ), (((GCallback) (panel_properties_dialog_size_changed))), (dialog ), ((void*)0), G_CONNECT_SWAPPED) |
243 | dialog)g_signal_connect_data ((dialog->size_spin), ("value_changed" ), (((GCallback) (panel_properties_dialog_size_changed))), (dialog ), ((void*)0), G_CONNECT_SWAPPED); |
244 | |
245 | if ( ! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_SIZE_KEY"size")) { |
246 | ctk_widget_set_sensitive (dialog->size_spin, FALSE(0)); |
247 | ctk_widget_set_sensitive (dialog->size_label, FALSE(0)); |
248 | ctk_widget_set_sensitive (dialog->size_label_pixels, FALSE(0)); |
249 | ctk_widget_show (dialog->writability_warn_general); |
250 | } |
251 | } |
252 | |
253 | static void |
254 | panel_properties_dialog_icon_changed (PanelIconChooser *chooser, |
255 | const char *icon, |
256 | PanelPropertiesDialog *dialog) |
257 | { |
258 | panel_profile_set_attached_custom_icon (dialog->toplevel, icon); |
259 | } |
260 | |
261 | static void |
262 | panel_properties_dialog_setup_icon_chooser (PanelPropertiesDialog *dialog, |
263 | CtkBuilder *gui) |
264 | { |
265 | char *custom_icon; |
266 | |
267 | dialog->icon_align = PANEL_CTK_BUILDER_GET (gui, "icon_align")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "icon_align"))), ((ctk_widget_get_type ())))))); |
268 | g_return_if_fail (dialog->icon_align != NULL)do { if ((dialog->icon_align != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->icon_align != NULL" ); return; } } while (0); |
269 | |
270 | dialog->icon_chooser = panel_icon_chooser_new (NULL((void*)0)); |
271 | panel_icon_chooser_set_fallback_icon_name (PANEL_ICON_CHOOSER (dialog->icon_chooser)((((PanelIconChooser*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((dialog->icon_chooser)), ((panel_icon_chooser_get_type ())))))), |
272 | PANEL_ICON_DRAWER"cafe-panel-drawer"); |
273 | ctk_widget_show (dialog->icon_chooser); |
274 | ctk_container_add (CTK_CONTAINER (dialog->icon_align)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->icon_align)), ((ctk_container_get_type ())))) )), |
275 | dialog->icon_chooser); |
276 | |
277 | dialog->icon_label = PANEL_CTK_BUILDER_GET (gui, "icon_label")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "icon_label"))), ((ctk_widget_get_type ())))))); |
278 | g_return_if_fail (dialog->icon_label != NULL)do { if ((dialog->icon_label != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->icon_label != NULL" ); return; } } while (0); |
279 | |
280 | custom_icon = panel_profile_get_attached_custom_icon (dialog->toplevel); |
281 | panel_icon_chooser_set_icon (PANEL_ICON_CHOOSER (dialog->icon_chooser)((((PanelIconChooser*) (void *) g_type_check_instance_cast (( GTypeInstance*) ((dialog->icon_chooser)), ((panel_icon_chooser_get_type ())))))), |
282 | custom_icon); |
283 | g_free (custom_icon); |
284 | |
285 | g_signal_connect (dialog->icon_chooser, "changed",g_signal_connect_data ((dialog->icon_chooser), ("changed") , (((GCallback) (panel_properties_dialog_icon_changed))), (dialog ), ((void*)0), (GConnectFlags) 0) |
286 | G_CALLBACK (panel_properties_dialog_icon_changed), dialog)g_signal_connect_data ((dialog->icon_chooser), ("changed") , (((GCallback) (panel_properties_dialog_icon_changed))), (dialog ), ((void*)0), (GConnectFlags) 0); |
287 | |
288 | if (!panel_profile_is_writable_attached_custom_icon (dialog->toplevel)) { |
289 | ctk_widget_set_sensitive (dialog->icon_chooser, FALSE(0)); |
290 | ctk_widget_set_sensitive (dialog->icon_label, FALSE(0)); |
291 | if (panel_toplevel_get_is_attached (dialog->toplevel)) |
292 | ctk_widget_show (dialog->writability_warn_general); |
293 | } |
294 | } |
295 | |
296 | /* Note: this is only for toggle buttons on the general page, if needed for togglebuttons |
297 | elsewhere you must make this respect the writability warning thing for the right page */ |
298 | #define SETUP_TOGGLE_BUTTON(wid, n, p, key)static void panel_properties_dialog_n (PanelPropertiesDialog * dialog, CtkToggleButton *n) { panel_profile_set_toplevel_p (dialog ->toplevel, ctk_toggle_button_get_active (n)); } static void panel_properties_dialog_setup_n (PanelPropertiesDialog *dialog , CtkBuilder *gui) { dialog->n = ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (gui, wid))), ((ctk_widget_get_type ())))))); ctk_toggle_button_set_active (((((CtkToggleButton* ) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->n)), ((ctk_toggle_button_get_type ())))))), panel_profile_get_toplevel_p (dialog->toplevel)); g_signal_connect_data ((dialog->n ), ("toggled"), (((GCallback) (panel_properties_dialog_n))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); if ( ! panel_profile_key_is_writable (dialog->toplevel, key)) { ctk_widget_set_sensitive (dialog ->n, (0)); ctk_widget_show (dialog->writability_warn_general ); } } \ |
299 | static void \ |
300 | panel_properties_dialog_##n (PanelPropertiesDialog *dialog, \ |
301 | CtkToggleButton *n) \ |
302 | { \ |
303 | panel_profile_set_toplevel_##p (dialog->toplevel, \ |
304 | ctk_toggle_button_get_active (n)); \ |
305 | } \ |
306 | static void \ |
307 | panel_properties_dialog_setup_##n (PanelPropertiesDialog *dialog, \ |
308 | CtkBuilder *gui) \ |
309 | { \ |
310 | dialog->n = PANEL_CTK_BUILDER_GET (gui, wid)((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, wid))), ((ctk_widget_get_type ())))))); \ |
311 | ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (dialog->n)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->n)), ((ctk_toggle_button_get_type ())))))), \ |
312 | panel_profile_get_toplevel_##p (dialog->toplevel)); \ |
313 | g_signal_connect_swapped (dialog->n, "toggled", \g_signal_connect_data ((dialog->n), ("toggled"), (((GCallback ) (panel_properties_dialog_##n))), (dialog), ((void*)0), G_CONNECT_SWAPPED ) |
314 | G_CALLBACK (panel_properties_dialog_##n), dialog)g_signal_connect_data ((dialog->n), ("toggled"), (((GCallback ) (panel_properties_dialog_##n))), (dialog), ((void*)0), G_CONNECT_SWAPPED ); \ |
315 | if ( ! panel_profile_key_is_writable (dialog->toplevel, key)) { \ |
316 | ctk_widget_set_sensitive (dialog->n, FALSE(0)); \ |
317 | ctk_widget_show (dialog->writability_warn_general); \ |
318 | } \ |
319 | } |
320 | |
321 | SETUP_TOGGLE_BUTTON ("expand_toggle", expand_toggle, expand, PANEL_TOPLEVEL_EXPAND_KEY)static void panel_properties_dialog_expand_toggle (PanelPropertiesDialog *dialog, CtkToggleButton *expand_toggle) { panel_profile_set_toplevel_expand (dialog->toplevel, ctk_toggle_button_get_active (expand_toggle )); } static void panel_properties_dialog_setup_expand_toggle (PanelPropertiesDialog *dialog, CtkBuilder *gui) { dialog-> expand_toggle = ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (gui, "expand_toggle" ))), ((ctk_widget_get_type ())))))); ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((dialog->expand_toggle)), ((ctk_toggle_button_get_type ())))))), panel_profile_get_toplevel_expand (dialog->toplevel )); g_signal_connect_data ((dialog->expand_toggle), ("toggled" ), (((GCallback) (panel_properties_dialog_expand_toggle))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); if ( ! panel_profile_key_is_writable (dialog->toplevel, "expand")) { ctk_widget_set_sensitive ( dialog->expand_toggle, (0)); ctk_widget_show (dialog->writability_warn_general ); } } |
322 | SETUP_TOGGLE_BUTTON ("autohide_toggle", autohide_toggle, auto_hide, PANEL_TOPLEVEL_AUTO_HIDE_KEY)static void panel_properties_dialog_autohide_toggle (PanelPropertiesDialog *dialog, CtkToggleButton *autohide_toggle) { panel_profile_set_toplevel_auto_hide (dialog->toplevel, ctk_toggle_button_get_active (autohide_toggle )); } static void panel_properties_dialog_setup_autohide_toggle (PanelPropertiesDialog *dialog, CtkBuilder *gui) { dialog-> autohide_toggle = ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (gui, "autohide_toggle" ))), ((ctk_widget_get_type ())))))); ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((dialog->autohide_toggle)), ((ctk_toggle_button_get_type ())))))), panel_profile_get_toplevel_auto_hide (dialog->toplevel )); g_signal_connect_data ((dialog->autohide_toggle), ("toggled" ), (((GCallback) (panel_properties_dialog_autohide_toggle))), (dialog), ((void*)0), G_CONNECT_SWAPPED); if ( ! panel_profile_key_is_writable (dialog->toplevel, "auto-hide")) { ctk_widget_set_sensitive (dialog->autohide_toggle, (0)); ctk_widget_show (dialog-> writability_warn_general); } } |
323 | SETUP_TOGGLE_BUTTON ("hidebuttons_toggle", hidebuttons_toggle, enable_buttons, PANEL_TOPLEVEL_ENABLE_BUTTONS_KEY)static void panel_properties_dialog_hidebuttons_toggle (PanelPropertiesDialog *dialog, CtkToggleButton *hidebuttons_toggle) { panel_profile_set_toplevel_enable_buttons (dialog->toplevel, ctk_toggle_button_get_active (hidebuttons_toggle )); } static void panel_properties_dialog_setup_hidebuttons_toggle (PanelPropertiesDialog *dialog, CtkBuilder *gui) { dialog-> hidebuttons_toggle = ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (gui, "hidebuttons_toggle" ))), ((ctk_widget_get_type ())))))); ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((dialog->hidebuttons_toggle)), ((ctk_toggle_button_get_type ())))))), panel_profile_get_toplevel_enable_buttons (dialog-> toplevel)); g_signal_connect_data ((dialog->hidebuttons_toggle ), ("toggled"), (((GCallback) (panel_properties_dialog_hidebuttons_toggle ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); if ( ! panel_profile_key_is_writable (dialog->toplevel, "enable-buttons")) { ctk_widget_set_sensitive (dialog->hidebuttons_toggle, (0)); ctk_widget_show (dialog ->writability_warn_general); } } |
324 | SETUP_TOGGLE_BUTTON ("arrows_toggle", arrows_toggle, enable_arrows, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY)static void panel_properties_dialog_arrows_toggle (PanelPropertiesDialog *dialog, CtkToggleButton *arrows_toggle) { panel_profile_set_toplevel_enable_arrows (dialog->toplevel, ctk_toggle_button_get_active (arrows_toggle )); } static void panel_properties_dialog_setup_arrows_toggle (PanelPropertiesDialog *dialog, CtkBuilder *gui) { dialog-> arrows_toggle = ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((ctk_builder_get_object (gui, "arrows_toggle" ))), ((ctk_widget_get_type ())))))); ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((dialog->arrows_toggle)), ((ctk_toggle_button_get_type ())))))), panel_profile_get_toplevel_enable_arrows (dialog-> toplevel)); g_signal_connect_data ((dialog->arrows_toggle) , ("toggled"), (((GCallback) (panel_properties_dialog_arrows_toggle ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); if ( ! panel_profile_key_is_writable (dialog->toplevel, "enable-arrows")) { ctk_widget_set_sensitive (dialog->arrows_toggle, (0)); ctk_widget_show (dialog-> writability_warn_general); } } |
325 | |
326 | static void |
327 | panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog, |
328 | CtkColorChooser *color_button) |
329 | { |
330 | CdkRGBA color; |
331 | |
332 | g_assert (dialog->color_button == CTK_WIDGET (color_button))do { if (dialog->color_button == ((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((color_button)), ((ctk_widget_get_type () ))))))) ; else g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c" , 332, ((const char*) (__func__)), "dialog->color_button == CTK_WIDGET (color_button)" ); } while (0); |
333 | |
334 | ctk_color_chooser_get_rgba (color_button, &color); |
335 | panel_profile_set_background_cdk_rgba (dialog->toplevel, &color); |
336 | panel_properties_dialog_opacity_changed (dialog); |
337 | } |
338 | |
339 | static void |
340 | panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog, |
341 | CtkBuilder *gui) |
342 | { |
343 | CdkRGBA color; |
344 | |
345 | dialog->color_button = PANEL_CTK_BUILDER_GET (gui, "color_button")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "color_button"))), ((ctk_widget_get_type ())))))); |
346 | g_return_if_fail (dialog->color_button != NULL)do { if ((dialog->color_button != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->color_button != NULL" ); return; } } while (0); |
347 | dialog->color_label = PANEL_CTK_BUILDER_GET (gui, "color_label")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "color_label"))), ((ctk_widget_get_type ())))))); |
348 | g_return_if_fail (dialog->color_label != NULL)do { if ((dialog->color_label != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__)), "dialog->color_label != NULL" ); return; } } while (0); |
349 | |
350 | panel_profile_get_background_color (dialog->toplevel, &color); |
351 | |
352 | ctk_color_chooser_set_rgba (CTK_COLOR_CHOOSER (dialog->color_button)((((CtkColorChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->color_button)), ((ctk_color_chooser_get_type ( ))))))), |
353 | &color); |
354 | |
355 | g_signal_connect_swapped (dialog->color_button, "color_set",g_signal_connect_data ((dialog->color_button), ("color_set" ), (((GCallback) (panel_properties_dialog_color_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED) |
356 | G_CALLBACK (panel_properties_dialog_color_changed),g_signal_connect_data ((dialog->color_button), ("color_set" ), (((GCallback) (panel_properties_dialog_color_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED) |
357 | dialog)g_signal_connect_data ((dialog->color_button), ("color_set" ), (((GCallback) (panel_properties_dialog_color_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); |
358 | |
359 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "color")) { |
360 | ctk_widget_set_sensitive (dialog->color_button, FALSE(0)); |
361 | ctk_widget_set_sensitive (dialog->color_label, FALSE(0)); |
362 | ctk_widget_show (dialog->writability_warn_background); |
363 | } |
364 | } |
365 | |
366 | static void |
367 | panel_properties_dialog_image_changed (PanelPropertiesDialog *dialog) |
368 | { |
369 | char *image; |
370 | |
371 | image = ctk_file_chooser_get_filename (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( )))))))); |
372 | |
373 | /* FIXME: This is an ugly workaround for CTK+ bug #327243. |
374 | * FIXME: Note that CTK+ 2.12 and file-set signal might help. */ |
375 | if (! (dialog->selection_emitted < 2) && !image) { |
376 | dialog->selection_emitted++; |
377 | return; |
378 | } |
379 | panel_profile_set_background_image (dialog->toplevel, image); |
380 | |
381 | g_free (image); |
382 | } |
383 | |
384 | static void |
385 | panel_properties_dialog_setup_image_chooser (PanelPropertiesDialog *dialog, |
386 | CtkBuilder *gui) |
387 | { |
388 | char *image; |
389 | |
390 | dialog->image_chooser = PANEL_CTK_BUILDER_GET (gui, "image_chooser")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "image_chooser"))), ((ctk_widget_get_type ())))))); |
391 | panel_ctk_file_chooser_add_image_preview (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( )))))))); |
392 | |
393 | image = panel_profile_get_background_image (dialog->toplevel); |
394 | |
395 | if (PANEL_GLIB_STR_EMPTY (image)((image) == ((void*)0) || (image)[0] == '\0')) |
396 | ctk_file_chooser_unselect_all (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( )))))))); |
397 | else |
398 | ctk_file_chooser_set_filename (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( ))))))), |
399 | image); |
400 | |
401 | if (image) |
402 | g_free (image); |
403 | |
404 | dialog->selection_emitted = 0; |
405 | g_signal_connect_swapped (dialog->image_chooser, "selection-changed",g_signal_connect_data ((dialog->image_chooser), ("selection-changed" ), (((GCallback) (panel_properties_dialog_image_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED) |
406 | G_CALLBACK (panel_properties_dialog_image_changed),g_signal_connect_data ((dialog->image_chooser), ("selection-changed" ), (((GCallback) (panel_properties_dialog_image_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED) |
407 | dialog)g_signal_connect_data ((dialog->image_chooser), ("selection-changed" ), (((GCallback) (panel_properties_dialog_image_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); |
408 | |
409 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "image")) { |
410 | ctk_widget_set_sensitive (dialog->image_chooser, FALSE(0)); |
411 | ctk_widget_show (dialog->writability_warn_background); |
412 | } |
413 | } |
414 | |
415 | static void |
416 | panel_properties_dialog_opacity_changed (PanelPropertiesDialog *dialog) |
417 | { |
418 | gdouble percentage; |
419 | guint16 opacity; |
420 | |
421 | percentage = ctk_range_get_value (CTK_RANGE (dialog->opacity_scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->opacity_scale)), ((ctk_range_get_type ()))))) )); |
422 | |
423 | if (percentage >= 98) |
424 | percentage = 100; |
425 | else if (percentage <= 2) |
426 | percentage = 0; |
427 | |
428 | opacity = (percentage / 100) * 65535; |
429 | |
430 | panel_profile_set_background_opacity (dialog->toplevel, opacity); |
431 | } |
432 | |
433 | static void |
434 | panel_properties_dialog_setup_opacity_scale (PanelPropertiesDialog *dialog, |
435 | CtkBuilder *gui) |
436 | { |
437 | guint16 opacity; |
438 | gdouble percentage; |
439 | |
440 | dialog->opacity_scale = PANEL_CTK_BUILDER_GET (gui, "opacity_scale")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "opacity_scale"))), ((ctk_widget_get_type ())))))); |
441 | g_return_if_fail (dialog->opacity_scale != NULL)do { if ((dialog->opacity_scale != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->opacity_scale != NULL"); return; } } while (0 ); |
442 | dialog->opacity_label = PANEL_CTK_BUILDER_GET (gui, "opacity_label")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "opacity_label"))), ((ctk_widget_get_type ())))))); |
443 | g_return_if_fail (dialog->opacity_label != NULL)do { if ((dialog->opacity_label != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->opacity_label != NULL"); return; } } while (0 ); |
444 | dialog->opacity_legend = PANEL_CTK_BUILDER_GET (gui, "opacity_legend")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "opacity_legend"))), ((ctk_widget_get_type ())))))); |
445 | g_return_if_fail (dialog->opacity_legend != NULL)do { if ((dialog->opacity_legend != ((void*)0))) { } else { g_return_if_fail_warning (((gchar*) 0), ((const char*) (__func__ )), "dialog->opacity_legend != NULL"); return; } } while ( 0); |
446 | |
447 | opacity = panel_profile_get_background_opacity (dialog->toplevel); |
448 | |
449 | percentage = (opacity * 100.0) / 65535; |
450 | |
451 | ctk_range_set_value (CTK_RANGE (dialog->opacity_scale)((((CtkRange*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->opacity_scale)), ((ctk_range_get_type ()))))) ), percentage); |
452 | |
453 | g_signal_connect_swapped (dialog->opacity_scale, "value_changed",g_signal_connect_data ((dialog->opacity_scale), ("value_changed" ), (((GCallback) (panel_properties_dialog_opacity_changed))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
454 | G_CALLBACK (panel_properties_dialog_opacity_changed),g_signal_connect_data ((dialog->opacity_scale), ("value_changed" ), (((GCallback) (panel_properties_dialog_opacity_changed))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
455 | dialog)g_signal_connect_data ((dialog->opacity_scale), ("value_changed" ), (((GCallback) (panel_properties_dialog_opacity_changed))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
456 | |
457 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "opacity")) { |
458 | ctk_widget_set_sensitive (dialog->opacity_scale, FALSE(0)); |
459 | ctk_widget_set_sensitive (dialog->opacity_label, FALSE(0)); |
460 | ctk_widget_set_sensitive (dialog->opacity_legend, FALSE(0)); |
461 | ctk_widget_show (dialog->writability_warn_background); |
462 | } |
463 | } |
464 | |
465 | static void |
466 | panel_properties_dialog_upd_sensitivity (PanelPropertiesDialog *dialog, |
467 | PanelBackgroundType background_type) |
468 | { |
469 | ctk_widget_set_sensitive (dialog->color_widgets, |
470 | background_type == PANEL_BACK_COLOR); |
471 | ctk_widget_set_sensitive (dialog->image_widgets, |
472 | background_type == PANEL_BACK_IMAGE); |
473 | } |
474 | |
475 | static void |
476 | panel_properties_dialog_background_toggled (PanelPropertiesDialog *dialog, |
477 | CtkWidget *radio) |
478 | { |
479 | PanelBackgroundType background_type = PANEL_BACK_NONE; |
480 | |
481 | if (!ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((radio)), ((ctk_toggle_button_get_type ())))))))) |
482 | return; |
483 | |
484 | if (radio == dialog->default_radio) |
485 | background_type = PANEL_BACK_NONE; |
486 | |
487 | else if (radio == dialog->color_radio) |
488 | background_type = PANEL_BACK_COLOR; |
489 | |
490 | else if (radio == dialog->image_radio) |
491 | background_type = PANEL_BACK_IMAGE; |
492 | |
493 | panel_properties_dialog_upd_sensitivity (dialog, background_type); |
494 | |
495 | panel_profile_set_background_type (dialog->toplevel, background_type); |
496 | } |
497 | |
498 | static void |
499 | panel_properties_dialog_setup_background_radios (PanelPropertiesDialog *dialog, |
500 | CtkBuilder *gui) |
501 | { |
502 | PanelBackgroundType background_type; |
503 | CtkWidget *active_radio; |
504 | |
505 | dialog->default_radio = PANEL_CTK_BUILDER_GET (gui, "default_radio")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "default_radio"))), ((ctk_widget_get_type ())))))); |
506 | dialog->color_radio = PANEL_CTK_BUILDER_GET (gui, "color_radio")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "color_radio"))), ((ctk_widget_get_type ())))))); |
507 | dialog->image_radio = PANEL_CTK_BUILDER_GET (gui, "image_radio")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "image_radio"))), ((ctk_widget_get_type ())))))); |
508 | dialog->color_widgets = PANEL_CTK_BUILDER_GET (gui, "color_widgets")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "color_widgets"))), ((ctk_widget_get_type ())))))); |
509 | dialog->image_widgets = PANEL_CTK_BUILDER_GET (gui, "image_widgets")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "image_widgets"))), ((ctk_widget_get_type ())))))); |
510 | |
511 | background_type = panel_profile_get_background_type (dialog->toplevel); |
512 | switch (background_type) { |
513 | case PANEL_BACK_NONE: |
514 | active_radio = dialog->default_radio; |
515 | break; |
516 | case PANEL_BACK_COLOR: |
517 | active_radio = dialog->color_radio; |
518 | break; |
519 | case PANEL_BACK_IMAGE: |
520 | active_radio = dialog->image_radio; |
521 | break; |
522 | default: |
523 | active_radio = NULL((void*)0); |
524 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c" , 524, ((const char*) (__func__)), ((void*)0)); } while (0); |
525 | } |
526 | |
527 | ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (active_radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((active_radio)), ((ctk_toggle_button_get_type ())))))), TRUE(!(0))); |
528 | |
529 | panel_properties_dialog_upd_sensitivity (dialog, background_type); |
530 | |
531 | g_signal_connect_swapped (dialog->default_radio, "toggled",g_signal_connect_data ((dialog->default_radio), ("toggled" ), (((GCallback) (panel_properties_dialog_background_toggled) )), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
532 | G_CALLBACK (panel_properties_dialog_background_toggled),g_signal_connect_data ((dialog->default_radio), ("toggled" ), (((GCallback) (panel_properties_dialog_background_toggled) )), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
533 | dialog)g_signal_connect_data ((dialog->default_radio), ("toggled" ), (((GCallback) (panel_properties_dialog_background_toggled) )), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
534 | g_signal_connect_swapped (dialog->color_radio, "toggled",g_signal_connect_data ((dialog->color_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED) |
535 | G_CALLBACK (panel_properties_dialog_background_toggled),g_signal_connect_data ((dialog->color_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED) |
536 | dialog)g_signal_connect_data ((dialog->color_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED); |
537 | g_signal_connect_swapped (dialog->image_radio, "toggled",g_signal_connect_data ((dialog->image_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED) |
538 | G_CALLBACK (panel_properties_dialog_background_toggled),g_signal_connect_data ((dialog->image_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED) |
539 | dialog)g_signal_connect_data ((dialog->image_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED); |
540 | |
541 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "type")) { |
542 | ctk_widget_set_sensitive (dialog->default_radio, FALSE(0)); |
543 | ctk_widget_set_sensitive (dialog->color_radio, FALSE(0)); |
544 | ctk_widget_set_sensitive (dialog->image_radio, FALSE(0)); |
545 | ctk_widget_show (dialog->writability_warn_background); |
546 | } |
547 | } |
548 | |
549 | static void |
550 | panel_properties_update_arrows_toggle_visible (PanelPropertiesDialog *dialog, |
551 | CtkToggleButton *toggle) |
552 | { |
553 | if (ctk_toggle_button_get_active (toggle)) |
554 | ctk_widget_set_sensitive (dialog->arrows_toggle, |
555 | panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY"enable-arrows")); |
556 | else |
557 | ctk_widget_set_sensitive (dialog->arrows_toggle, FALSE(0)); |
558 | } |
559 | |
560 | static void |
561 | panel_properties_dialog_response (PanelPropertiesDialog *dialog, |
562 | int response, |
563 | CtkWidget *properties_dialog) |
564 | { |
565 | char *help_id; |
566 | |
567 | switch (response) { |
568 | case CTK_RESPONSE_CLOSE: |
569 | ctk_widget_destroy (properties_dialog); |
570 | break; |
571 | case CTK_RESPONSE_HELP: |
572 | if (panel_toplevel_get_is_attached (dialog->toplevel)) { |
573 | help_id = "gospanel-550"; |
574 | } else { |
575 | help_id = "gospanel-28"; |
576 | } |
577 | panel_show_help (ctk_window_get_screen (CTK_WINDOW (properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((properties_dialog)), ((ctk_window_get_type ()))))))), |
578 | "cafe-user-guide", help_id, NULL((void*)0)); |
579 | break; |
580 | default: |
581 | break; |
582 | } |
583 | } |
584 | |
585 | static void |
586 | panel_properties_dialog_destroy (PanelPropertiesDialog *dialog) |
587 | { |
588 | panel_toplevel_pop_autohide_disabler (PANEL_TOPLEVEL (dialog->toplevel)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->toplevel)), ((panel_toplevel_get_type ()))))) )); |
589 | g_object_set_qdata (G_OBJECT (dialog->toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->toplevel)), (((GType) ((20) << (2)))))) )), |
590 | panel_properties_dialog_quark, |
591 | NULL((void*)0)); |
592 | } |
593 | |
594 | static void |
595 | panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog, |
596 | PanelOrientation orientation) |
597 | { |
598 | CtkTreeModel *model; |
599 | CtkTreeIter iter; |
600 | OrientationComboItem *item; |
601 | int max_size; |
602 | int spin_size; |
603 | int profile_size; |
604 | |
605 | /* change the maximum size of the panel */ |
606 | //TODO: we should also do this when the monitor size changes |
607 | max_size = panel_toplevel_get_maximum_size (dialog->toplevel); |
608 | spin_size = ctk_spin_button_get_value_as_int (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) )))); |
609 | profile_size = panel_profile_get_toplevel_size (dialog->toplevel); |
610 | |
611 | ctk_spin_button_set_range (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), |
612 | panel_toplevel_get_minimum_size (dialog->toplevel), |
613 | max_size); |
614 | |
615 | if (spin_size > max_size) |
616 | ctk_spin_button_set_value (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), |
617 | max_size); |
618 | else if (spin_size != profile_size) |
619 | ctk_spin_button_set_value (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), |
620 | MIN (profile_size, max_size)(((profile_size) < (max_size)) ? (profile_size) : (max_size ))); |
621 | |
622 | /* update the orientation combo box */ |
623 | model = ctk_combo_box_get_model (CTK_COMBO_BOX (dialog->orientation_combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_combo_box_get_type ()))))))); |
624 | |
625 | if (!ctk_tree_model_get_iter_first (model, &iter)) |
626 | return; |
627 | |
628 | do { |
629 | ctk_tree_model_get (model, &iter, COLUMN_ITEM, &item, -1); |
630 | if (item != NULL((void*)0) && item->orientation == orientation) { |
631 | ctk_combo_box_set_active_iter (CTK_COMBO_BOX (dialog->orientation_combo)((((CtkComboBox*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->orientation_combo)), ((ctk_combo_box_get_type ())))))), |
632 | &iter); |
633 | return; |
634 | } |
635 | } while (ctk_tree_model_iter_next (model, &iter)); |
636 | } |
637 | |
638 | static void |
639 | panel_properties_dialog_update_size (PanelPropertiesDialog *dialog, |
640 | int size) |
641 | { |
642 | ctk_spin_button_set_value (CTK_SPIN_BUTTON (dialog->size_spin)((((CtkSpinButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->size_spin)), ((ctk_spin_button_get_type ()))) ))), size); |
643 | } |
644 | |
645 | static void |
646 | panel_properties_dialog_toplevel_notify (GSettings *settings, |
647 | gchar *key, |
648 | PanelPropertiesDialog *dialog) |
649 | { |
650 | |
651 | #define UPDATE_TOGGLE(p, n)if (!strcmp (key, p)) { gboolean val = g_settings_get_boolean (settings, key); if (ctk_toggle_button_get_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->n)), ((ctk_toggle_button_get_type ()))))))) != val) ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ( (GTypeInstance*) ((dialog->n)), ((ctk_toggle_button_get_type ())))))), val); } \ |
652 | if (!strcmp (key, p)) { \ |
653 | gboolean val = g_settings_get_boolean (settings, key); \ |
654 | if (ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (dialog->n)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->n)), ((ctk_toggle_button_get_type ()))))))) != val) \ |
655 | ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (dialog->n)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->n)), ((ctk_toggle_button_get_type ())))))), val); \ |
656 | } |
657 | |
658 | if (!strcmp (key, "orientation")) |
659 | panel_properties_dialog_update_orientation (dialog, g_settings_get_enum (settings, key)); |
660 | else if (!strcmp (key, "size")) |
661 | panel_properties_dialog_update_size (dialog, g_settings_get_int (settings, key)); |
662 | else UPDATE_TOGGLE ("expand", expand_toggle)if (!strcmp (key, "expand")) { gboolean val = g_settings_get_boolean (settings, key); if (ctk_toggle_button_get_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->expand_toggle)), ((ctk_toggle_button_get_type ()))))))) != val) ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog-> expand_toggle)), ((ctk_toggle_button_get_type ())))))), val); } |
663 | else UPDATE_TOGGLE ("auto-hide", autohide_toggle)if (!strcmp (key, "auto-hide")) { gboolean val = g_settings_get_boolean (settings, key); if (ctk_toggle_button_get_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->autohide_toggle)), ((ctk_toggle_button_get_type ())))))) ) != val) ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->autohide_toggle)), ((ctk_toggle_button_get_type ())))))) , val); } |
664 | else UPDATE_TOGGLE ("enable-buttons", hidebuttons_toggle)if (!strcmp (key, "enable-buttons")) { gboolean val = g_settings_get_boolean (settings, key); if (ctk_toggle_button_get_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->hidebuttons_toggle)), ((ctk_toggle_button_get_type ()))) )))) != val) ctk_toggle_button_set_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->hidebuttons_toggle)), ((ctk_toggle_button_get_type ()))) ))), val); } |
665 | else UPDATE_TOGGLE ("enable-arrows", arrows_toggle)if (!strcmp (key, "enable-arrows")) { gboolean val = g_settings_get_boolean (settings, key); if (ctk_toggle_button_get_active (((((CtkToggleButton *) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog ->arrows_toggle)), ((ctk_toggle_button_get_type ()))))))) != val) ctk_toggle_button_set_active (((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance*) ((dialog-> arrows_toggle)), ((ctk_toggle_button_get_type ())))))), val); } |
666 | } |
667 | |
668 | static void |
669 | panel_properties_dialog_update_background_type (PanelPropertiesDialog *dialog, |
670 | PanelBackgroundType background_type) |
671 | { |
672 | CtkWidget *active_radio; |
673 | |
674 | switch (background_type) { |
675 | case PANEL_BACK_NONE: |
676 | active_radio = dialog->default_radio; |
677 | break; |
678 | case PANEL_BACK_COLOR: |
679 | active_radio = dialog->color_radio; |
680 | break; |
681 | case PANEL_BACK_IMAGE: |
682 | active_radio = dialog->image_radio; |
683 | break; |
684 | default: |
685 | active_radio = NULL((void*)0); |
686 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c" , 686, ((const char*) (__func__)), ((void*)0)); } while (0); |
687 | break; |
688 | } |
689 | |
690 | ctk_toggle_button_set_active (CTK_TOGGLE_BUTTON (active_radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((active_radio)), ((ctk_toggle_button_get_type ())))))), TRUE(!(0))); |
691 | } |
692 | |
693 | static void |
694 | panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog, |
695 | gchar *str_color) |
696 | { |
697 | CdkRGBA new_color; |
698 | CdkRGBA old_color; |
699 | |
700 | if (!cdk_rgba_parse (&new_color, str_color)) |
701 | return; |
702 | |
703 | ctk_color_chooser_get_rgba (CTK_COLOR_CHOOSER (dialog->color_button)((((CtkColorChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->color_button)), ((ctk_color_chooser_get_type ( ))))))), |
704 | &old_color); |
705 | |
706 | if (!cdk_rgba_equal (&old_color, &new_color)) |
707 | ctk_color_chooser_set_rgba (CTK_COLOR_CHOOSER (dialog->color_button)((((CtkColorChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->color_button)), ((ctk_color_chooser_get_type ( ))))))), |
708 | &new_color); |
709 | } |
710 | |
711 | static void |
712 | panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, |
713 | gchar *text) |
714 | { |
715 | char *old_text; |
716 | |
717 | old_text = ctk_file_chooser_get_filename (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( )))))))); |
718 | |
719 | if (PANEL_GLIB_STR_EMPTY (text)((text) == ((void*)0) || (text)[0] == '\0') && old_text) |
720 | ctk_file_chooser_unselect_all (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( )))))))); |
721 | else if (!PANEL_GLIB_STR_EMPTY (text)((text) == ((void*)0) || (text)[0] == '\0') && |
722 | (!old_text || strcmp (text, old_text))) |
723 | ctk_file_chooser_set_filename (CTK_FILE_CHOOSER (dialog->image_chooser)((((CtkFileChooser*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->image_chooser)), ((ctk_file_chooser_get_type ( ))))))), |
724 | text); |
725 | |
726 | if (old_text) |
727 | g_free (old_text); |
728 | } |
729 | |
730 | static void |
731 | panel_properties_dialog_background_notify (GSettings *settings, |
732 | gchar *key, |
733 | PanelPropertiesDialog *dialog) |
734 | { |
735 | if (!strcmp (key, "type")) |
736 | { |
737 | PanelBackgroundType type = g_settings_get_enum (settings, key); |
738 | panel_properties_dialog_update_background_type (dialog, type); |
739 | } |
740 | else if (!strcmp (key, "color")) |
741 | { |
742 | char *color = g_settings_get_string (settings, key); |
743 | panel_properties_dialog_update_background_color (dialog, color); |
744 | g_free (color); |
745 | } |
746 | else if (!strcmp (key, "image")) |
747 | { |
748 | char *image = g_settings_get_string (settings, key); |
749 | panel_properties_dialog_update_background_image (dialog, image); |
750 | g_free (image); |
751 | } |
752 | } |
753 | |
754 | static void |
755 | panel_properties_dialog_remove_orientation_combo (PanelPropertiesDialog *dialog) |
756 | { |
757 | CtkContainer *container = CTK_CONTAINER (dialog->general_table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_container_get_type ()) ))))); |
758 | CtkGrid *grid = CTK_GRID (dialog->general_table)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_grid_get_type ())))))); |
759 | |
760 | g_object_ref (dialog->size_label)((__typeof__ (dialog->size_label)) (g_object_ref) (dialog-> size_label)); |
761 | g_object_ref (dialog->size_widgets)((__typeof__ (dialog->size_widgets)) (g_object_ref) (dialog ->size_widgets)); |
762 | g_object_ref (dialog->icon_label)((__typeof__ (dialog->icon_label)) (g_object_ref) (dialog-> icon_label)); |
763 | g_object_ref (dialog->icon_align)((__typeof__ (dialog->icon_align)) (g_object_ref) (dialog-> icon_align)); |
764 | |
765 | ctk_container_remove (container, dialog->orientation_label); |
766 | ctk_container_remove (container, dialog->orientation_combo); |
767 | ctk_container_remove (container, dialog->size_label); |
768 | ctk_container_remove (container, dialog->size_widgets); |
769 | ctk_container_remove (container, dialog->icon_label); |
770 | ctk_container_remove (container, dialog->icon_align); |
771 | |
772 | ctk_grid_attach (grid, dialog->size_label, 0, 1, 1, 1); |
773 | ctk_grid_attach (grid, dialog->size_widgets, 1, 1, 1, 1); |
774 | ctk_grid_attach (grid, dialog->icon_label, 0, 2, 1, 1); |
775 | ctk_grid_attach (grid, dialog->icon_align, 1, 2, 1, 1); |
776 | |
777 | dialog->orientation_label = NULL((void*)0); |
778 | dialog->orientation_combo = NULL((void*)0); |
779 | g_object_unref (dialog->size_label); |
780 | g_object_unref (dialog->size_widgets); |
781 | g_object_unref (dialog->icon_label); |
782 | g_object_unref (dialog->icon_align); |
783 | } |
784 | |
785 | static void |
786 | panel_properties_dialog_remove_icon_chooser (PanelPropertiesDialog *dialog) |
787 | { |
788 | CtkContainer *container = CTK_CONTAINER (dialog->general_table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_container_get_type ()) ))))); |
789 | |
790 | ctk_container_remove (container, dialog->icon_label); |
791 | ctk_container_remove (container, dialog->icon_align); |
792 | |
793 | dialog->icon_label = NULL((void*)0); |
794 | dialog->icon_align = NULL((void*)0); |
795 | dialog->icon_chooser = NULL((void*)0); |
796 | } |
797 | |
798 | static void |
799 | panel_properties_dialog_remove_toggles (PanelPropertiesDialog *dialog) |
800 | { |
801 | CtkContainer *container = CTK_CONTAINER (dialog->general_vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_vbox)), ((ctk_container_get_type ())) )))); |
802 | |
803 | ctk_container_remove (container, dialog->autohide_toggle); |
804 | ctk_container_remove (container, dialog->expand_toggle); |
805 | |
806 | dialog->autohide_toggle = NULL((void*)0); |
807 | dialog->expand_toggle = NULL((void*)0); |
808 | } |
809 | |
810 | static void |
811 | panel_properties_dialog_update_for_attached (PanelPropertiesDialog *dialog, |
812 | gboolean attached) |
813 | { |
814 | if (!attached) |
815 | panel_properties_dialog_remove_icon_chooser (dialog); |
816 | else { |
817 | ctk_window_set_title (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
818 | _("Drawer Properties")gettext ("Drawer Properties")); |
819 | panel_properties_dialog_remove_toggles (dialog); |
820 | panel_properties_dialog_remove_orientation_combo (dialog); |
821 | } |
822 | } |
823 | |
824 | static PanelPropertiesDialog * |
825 | panel_properties_dialog_new (PanelToplevel *toplevel, |
826 | CtkBuilder *gui) |
827 | { |
828 | PanelPropertiesDialog *dialog; |
829 | char *toplevel_settings_path; |
830 | |
831 | dialog = g_new0 (PanelPropertiesDialog, 1)((PanelPropertiesDialog *) g_malloc0_n ((1), sizeof (PanelPropertiesDialog ))); |
832 | |
833 | g_object_set_qdata_full (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), |
834 | panel_properties_dialog_quark, |
835 | dialog, |
836 | (GDestroyNotify) panel_properties_dialog_free); |
837 | |
838 | dialog->toplevel = toplevel; |
839 | |
840 | dialog->properties_dialog = PANEL_CTK_BUILDER_GET (gui, "panel_properties_dialog")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "panel_properties_dialog")) ), ((ctk_widget_get_type ())))))); |
841 | g_signal_connect_swapped (dialog->properties_dialog, "response",g_signal_connect_data ((dialog->properties_dialog), ("response" ), (((GCallback) (panel_properties_dialog_response))), (dialog ), ((void*)0), G_CONNECT_SWAPPED) |
842 | G_CALLBACK (panel_properties_dialog_response), dialog)g_signal_connect_data ((dialog->properties_dialog), ("response" ), (((GCallback) (panel_properties_dialog_response))), (dialog ), ((void*)0), G_CONNECT_SWAPPED); |
843 | g_signal_connect_swapped (dialog->properties_dialog, "destroy",g_signal_connect_data ((dialog->properties_dialog), ("destroy" ), (((GCallback) (panel_properties_dialog_destroy))), (dialog ), ((void*)0), G_CONNECT_SWAPPED) |
844 | G_CALLBACK (panel_properties_dialog_destroy), dialog)g_signal_connect_data ((dialog->properties_dialog), ("destroy" ), (((GCallback) (panel_properties_dialog_destroy))), (dialog ), ((void*)0), G_CONNECT_SWAPPED); |
845 | |
846 | ctk_window_set_screen (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
847 | ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))))); |
848 | |
849 | dialog->writability_warn_general = PANEL_CTK_BUILDER_GET (gui, "writability_warn_general")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "writability_warn_general") )), ((ctk_widget_get_type ())))))); |
850 | dialog->writability_warn_background = PANEL_CTK_BUILDER_GET (gui, "writability_warn_background")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "writability_warn_background" ))), ((ctk_widget_get_type ())))))); |
851 | |
852 | dialog->general_vbox = PANEL_CTK_BUILDER_GET (gui, "general_vbox")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "general_vbox"))), ((ctk_widget_get_type ())))))); |
853 | dialog->general_table = PANEL_CTK_BUILDER_GET (gui, "general_table")((((CtkWidget*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((ctk_builder_get_object (gui, "general_table"))), ((ctk_widget_get_type ())))))); |
854 | |
855 | panel_properties_dialog_setup_orientation_combo (dialog, gui); |
856 | panel_properties_dialog_setup_size_spin (dialog, gui); |
857 | panel_properties_dialog_setup_icon_chooser (dialog, gui); |
858 | panel_properties_dialog_setup_expand_toggle (dialog, gui); |
859 | panel_properties_dialog_setup_autohide_toggle (dialog, gui); |
860 | panel_properties_dialog_setup_hidebuttons_toggle (dialog, gui); |
861 | panel_properties_dialog_setup_arrows_toggle (dialog, gui); |
862 | |
863 | g_signal_connect_swapped (dialog->expand_toggle, "toggled",g_signal_connect_data ((dialog->expand_toggle), ("toggled" ), (((GCallback) (panel_properties_dialog_setup_orientation_combo_sensitivty ))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
864 | G_CALLBACK (panel_properties_dialog_setup_orientation_combo_sensitivty), dialog)g_signal_connect_data ((dialog->expand_toggle), ("toggled" ), (((GCallback) (panel_properties_dialog_setup_orientation_combo_sensitivty ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
865 | |
866 | panel_properties_update_arrows_toggle_visible ( |
867 | dialog, CTK_TOGGLE_BUTTON (dialog->hidebuttons_toggle)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->hidebuttons_toggle)), ((ctk_toggle_button_get_type ()))))))); |
868 | g_signal_connect_swapped (dialog->hidebuttons_toggle, "toggled",g_signal_connect_data ((dialog->hidebuttons_toggle), ("toggled" ), (((GCallback) (panel_properties_update_arrows_toggle_visible ))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
869 | G_CALLBACK (panel_properties_update_arrows_toggle_visible),g_signal_connect_data ((dialog->hidebuttons_toggle), ("toggled" ), (((GCallback) (panel_properties_update_arrows_toggle_visible ))), (dialog), ((void*)0), G_CONNECT_SWAPPED) |
870 | dialog)g_signal_connect_data ((dialog->hidebuttons_toggle), ("toggled" ), (((GCallback) (panel_properties_update_arrows_toggle_visible ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
871 | |
872 | g_object_get (toplevel, "settings-path", &toplevel_settings_path, NULL((void*)0)); |
873 | dialog->settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA"org.cafe.panel.toplevel", |
874 | toplevel_settings_path); |
875 | gchar *toplevel_background_path; |
876 | toplevel_background_path = g_strdup_printf ("%sbackground/", toplevel_settings_path); |
877 | dialog->background_settings = g_settings_new_with_path (PANEL_TOPLEVEL_BACKGROUND_SCHEMA"org.cafe.panel.toplevel.background", |
878 | toplevel_background_path); |
879 | g_free (toplevel_background_path); |
880 | g_free (toplevel_settings_path); |
881 | |
882 | g_signal_connect (dialog->settings,g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0) |
883 | "changed",g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0) |
884 | G_CALLBACK (panel_properties_dialog_toplevel_notify),g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0) |
885 | dialog)g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0); |
886 | |
887 | panel_properties_dialog_setup_color_button (dialog, gui); |
888 | panel_properties_dialog_setup_image_chooser (dialog, gui); |
889 | panel_properties_dialog_setup_opacity_scale (dialog, gui); |
890 | panel_properties_dialog_setup_background_radios (dialog, gui); |
891 | |
892 | g_signal_connect (dialog->background_settings,g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0) |
893 | "changed",g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0) |
894 | G_CALLBACK (panel_properties_dialog_background_notify),g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0) |
895 | dialog)g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0); |
896 | |
897 | panel_properties_dialog_update_for_attached (dialog, |
898 | panel_toplevel_get_is_attached (dialog->toplevel)); |
899 | |
900 | panel_toplevel_push_autohide_disabler (dialog->toplevel); |
901 | panel_widget_register_open_dialog (panel_toplevel_get_panel_widget (dialog->toplevel), |
902 | dialog->properties_dialog); |
903 | |
904 | ctk_widget_show (dialog->properties_dialog); |
905 | |
906 | return dialog; |
907 | } |
908 | |
909 | void |
910 | panel_properties_dialog_present (PanelToplevel *toplevel) |
911 | { |
912 | PanelPropertiesDialog *dialog; |
913 | CtkBuilder *gui; |
914 | |
915 | if (!panel_properties_dialog_quark) |
916 | panel_properties_dialog_quark = |
917 | g_quark_from_static_string ("panel-properties-dialog"); |
918 | |
919 | dialog = g_object_get_qdata (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), panel_properties_dialog_quark); |
920 | if (dialog) { |
921 | ctk_window_set_screen (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
922 | ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))))); |
923 | ctk_window_present (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () ))))))); |
924 | return; |
925 | } |
926 | |
927 | gui = ctk_builder_new (); |
928 | ctk_builder_set_translation_domain (gui, GETTEXT_PACKAGE"cafe-panel"); |
929 | ctk_builder_add_from_resource (gui, |
930 | PANEL_RESOURCE_PATH"/org/cafe/panel/" "panel-properties-dialog.ui", |
931 | NULL((void*)0)); |
932 | |
933 | dialog = panel_properties_dialog_new (toplevel, gui); |
Value stored to 'dialog' is never read | |
934 | |
935 | g_object_unref (gui); |
936 | } |