| File: | cafe-panel/panel-properties-dialog.c |
| Warning: | line 934, 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, |
| 149 | CtkToggleButton *n G_GNUC_UNUSED__attribute__ ((__unused__))) |
| 150 | { |
| 151 | gboolean expand; |
| 152 | expand = panel_profile_get_toplevel_expand (dialog->toplevel); |
| 153 | |
| 154 | if (! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ORIENTATION_KEY"orientation")) { |
| 155 | ctk_widget_set_sensitive (dialog->orientation_combo, FALSE(0)); |
| 156 | ctk_widget_set_sensitive (dialog->orientation_label, FALSE(0)); |
| 157 | ctk_widget_show (dialog->writability_warn_general); |
| 158 | } |
| 159 | else { |
| 160 | /* enable orientation only for non-expanded panels */ |
| 161 | ctk_widget_set_sensitive (dialog->orientation_combo, expand); |
| 162 | ctk_widget_set_sensitive (dialog->orientation_label, expand); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | static void |
| 167 | panel_properties_dialog_setup_orientation_combo (PanelPropertiesDialog *dialog, |
| 168 | CtkBuilder *gui) |
| 169 | { |
| 170 | PanelOrientation orientation; |
| 171 | CtkListStore *model; |
| 172 | CtkTreeIter iter; |
| 173 | CtkCellRenderer *renderer; |
| 174 | int i; |
| 175 | |
| 176 | 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 ())))))); |
| 177 | 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); |
| 178 | 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 ())))))); |
| 179 | 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); |
| 180 | |
| 181 | orientation = panel_profile_get_toplevel_orientation (dialog->toplevel); |
| 182 | |
| 183 | model = ctk_list_store_new (NUMBER_COLUMNS, |
| 184 | G_TYPE_STRING((GType) ((16) << (2))), |
| 185 | G_TYPE_POINTER((GType) ((17) << (2)))); |
| 186 | |
| 187 | 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 ())))))), |
| 188 | CTK_TREE_MODEL (model)((((CtkTreeModel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((model)), ((ctk_tree_model_get_type ()))))))); |
| 189 | |
| 190 | for (i = 0; i < G_N_ELEMENTS (orientation_items)(sizeof (orientation_items) / sizeof ((orientation_items)[0]) ); i++) { |
| 191 | ctk_list_store_append (model, &iter); |
| 192 | ctk_list_store_set (model, &iter, |
| 193 | COLUMN_TEXT, g_dpgettext2 (NULL((void*)0), "Orientation", orientation_items [i].name), |
| 194 | COLUMN_ITEM, &(orientation_items [i]), |
| 195 | -1); |
| 196 | if (orientation == orientation_items [i].orientation) |
| 197 | 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 ())))))), |
| 198 | &iter); |
| 199 | } |
| 200 | |
| 201 | renderer = ctk_cell_renderer_text_new (); |
| 202 | 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 ())))))), |
| 203 | renderer, TRUE(!(0))); |
| 204 | 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 ())))))), |
| 205 | renderer, "text", COLUMN_TEXT, NULL((void*)0)); |
| 206 | |
| 207 | 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) |
| 208 | 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) |
| 209 | dialog)g_signal_connect_data ((dialog->orientation_combo), ("changed" ), (((GCallback) (panel_properties_dialog_orientation_changed ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 210 | |
| 211 | panel_properties_dialog_setup_orientation_combo_sensitivty (dialog, NULL((void*)0)); |
| 212 | } |
| 213 | |
| 214 | static void |
| 215 | panel_properties_dialog_size_changed (PanelPropertiesDialog *dialog, |
| 216 | CtkSpinButton *spin_button) |
| 217 | { |
| 218 | panel_profile_set_toplevel_size (dialog->toplevel, |
| 219 | ctk_spin_button_get_value_as_int (spin_button)); |
| 220 | } |
| 221 | |
| 222 | static void |
| 223 | panel_properties_dialog_setup_size_spin (PanelPropertiesDialog *dialog, |
| 224 | CtkBuilder *gui) |
| 225 | { |
| 226 | 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 ())))))); |
| 227 | 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); |
| 228 | 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 ())))))); |
| 229 | 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); |
| 230 | 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 ())))))); |
| 231 | 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); |
| 232 | 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 ())))))); |
| 233 | 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); |
| 234 | |
| 235 | 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 ()))) ))), |
| 236 | panel_toplevel_get_minimum_size (dialog->toplevel), |
| 237 | panel_toplevel_get_maximum_size (dialog->toplevel)); |
| 238 | |
| 239 | 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 ()))) ))), |
| 240 | panel_profile_get_toplevel_size (dialog->toplevel)); |
| 241 | |
| 242 | 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) |
| 243 | 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) |
| 244 | dialog)g_signal_connect_data ((dialog->size_spin), ("value_changed" ), (((GCallback) (panel_properties_dialog_size_changed))), (dialog ), ((void*)0), G_CONNECT_SWAPPED); |
| 245 | |
| 246 | if ( ! panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_SIZE_KEY"size")) { |
| 247 | ctk_widget_set_sensitive (dialog->size_spin, FALSE(0)); |
| 248 | ctk_widget_set_sensitive (dialog->size_label, FALSE(0)); |
| 249 | ctk_widget_set_sensitive (dialog->size_label_pixels, FALSE(0)); |
| 250 | ctk_widget_show (dialog->writability_warn_general); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | static void |
| 255 | panel_properties_dialog_icon_changed (PanelIconChooser *chooser G_GNUC_UNUSED__attribute__ ((__unused__)), |
| 256 | const char *icon, |
| 257 | PanelPropertiesDialog *dialog) |
| 258 | { |
| 259 | panel_profile_set_attached_custom_icon (dialog->toplevel, icon); |
| 260 | } |
| 261 | |
| 262 | static void |
| 263 | panel_properties_dialog_setup_icon_chooser (PanelPropertiesDialog *dialog, |
| 264 | CtkBuilder *gui) |
| 265 | { |
| 266 | char *custom_icon; |
| 267 | |
| 268 | 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 ())))))); |
| 269 | 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); |
| 270 | |
| 271 | dialog->icon_chooser = panel_icon_chooser_new (NULL((void*)0)); |
| 272 | 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 ())))))), |
| 273 | PANEL_ICON_DRAWER"cafe-panel-drawer"); |
| 274 | ctk_widget_show (dialog->icon_chooser); |
| 275 | ctk_container_add (CTK_CONTAINER (dialog->icon_align)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->icon_align)), ((ctk_container_get_type ())))) )), |
| 276 | dialog->icon_chooser); |
| 277 | |
| 278 | 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 ())))))); |
| 279 | 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); |
| 280 | |
| 281 | custom_icon = panel_profile_get_attached_custom_icon (dialog->toplevel); |
| 282 | 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 ())))))), |
| 283 | custom_icon); |
| 284 | g_free (custom_icon); |
| 285 | |
| 286 | 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) |
| 287 | 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); |
| 288 | |
| 289 | if (!panel_profile_is_writable_attached_custom_icon (dialog->toplevel)) { |
| 290 | ctk_widget_set_sensitive (dialog->icon_chooser, FALSE(0)); |
| 291 | ctk_widget_set_sensitive (dialog->icon_label, FALSE(0)); |
| 292 | if (panel_toplevel_get_is_attached (dialog->toplevel)) |
| 293 | ctk_widget_show (dialog->writability_warn_general); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | /* Note: this is only for toggle buttons on the general page, if needed for togglebuttons |
| 298 | elsewhere you must make this respect the writability warning thing for the right page */ |
| 299 | #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 ); } } \ |
| 300 | static void \ |
| 301 | panel_properties_dialog_##n (PanelPropertiesDialog *dialog, \ |
| 302 | CtkToggleButton *n) \ |
| 303 | { \ |
| 304 | panel_profile_set_toplevel_##p (dialog->toplevel, \ |
| 305 | ctk_toggle_button_get_active (n)); \ |
| 306 | } \ |
| 307 | static void \ |
| 308 | panel_properties_dialog_setup_##n (PanelPropertiesDialog *dialog, \ |
| 309 | CtkBuilder *gui) \ |
| 310 | { \ |
| 311 | 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 ())))))); \ |
| 312 | 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 ())))))), \ |
| 313 | panel_profile_get_toplevel_##p (dialog->toplevel)); \ |
| 314 | 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 ) |
| 315 | 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 ); \ |
| 316 | if ( ! panel_profile_key_is_writable (dialog->toplevel, key)) { \ |
| 317 | ctk_widget_set_sensitive (dialog->n, FALSE(0)); \ |
| 318 | ctk_widget_show (dialog->writability_warn_general); \ |
| 319 | } \ |
| 320 | } |
| 321 | |
| 322 | 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 ); } } |
| 323 | 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); } } |
| 324 | 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); } } |
| 325 | 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); } } |
| 326 | |
| 327 | static void |
| 328 | panel_properties_dialog_color_changed (PanelPropertiesDialog *dialog, |
| 329 | CtkColorChooser *color_button) |
| 330 | { |
| 331 | CdkRGBA color; |
| 332 | |
| 333 | 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" , 333, ((const char*) (__func__)), "dialog->color_button == CTK_WIDGET (color_button)" ); } while (0); |
| 334 | |
| 335 | ctk_color_chooser_get_rgba (color_button, &color); |
| 336 | panel_profile_set_background_cdk_rgba (dialog->toplevel, &color); |
| 337 | panel_properties_dialog_opacity_changed (dialog); |
| 338 | } |
| 339 | |
| 340 | static void |
| 341 | panel_properties_dialog_setup_color_button (PanelPropertiesDialog *dialog, |
| 342 | CtkBuilder *gui) |
| 343 | { |
| 344 | CdkRGBA color; |
| 345 | |
| 346 | 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 ())))))); |
| 347 | 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); |
| 348 | 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 ())))))); |
| 349 | 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); |
| 350 | |
| 351 | panel_profile_get_background_color (dialog->toplevel, &color); |
| 352 | |
| 353 | 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 ( ))))))), |
| 354 | &color); |
| 355 | |
| 356 | 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) |
| 357 | 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) |
| 358 | dialog)g_signal_connect_data ((dialog->color_button), ("color_set" ), (((GCallback) (panel_properties_dialog_color_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 359 | |
| 360 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "color")) { |
| 361 | ctk_widget_set_sensitive (dialog->color_button, FALSE(0)); |
| 362 | ctk_widget_set_sensitive (dialog->color_label, FALSE(0)); |
| 363 | ctk_widget_show (dialog->writability_warn_background); |
| 364 | } |
| 365 | } |
| 366 | |
| 367 | static void |
| 368 | panel_properties_dialog_image_changed (PanelPropertiesDialog *dialog) |
| 369 | { |
| 370 | char *image; |
| 371 | |
| 372 | 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 ( )))))))); |
| 373 | |
| 374 | /* FIXME: This is an ugly workaround for CTK+ bug #327243. |
| 375 | * FIXME: Note that CTK+ 2.12 and file-set signal might help. */ |
| 376 | if (! (dialog->selection_emitted < 2) && !image) { |
| 377 | dialog->selection_emitted++; |
| 378 | return; |
| 379 | } |
| 380 | panel_profile_set_background_image (dialog->toplevel, image); |
| 381 | |
| 382 | g_free (image); |
| 383 | } |
| 384 | |
| 385 | static void |
| 386 | panel_properties_dialog_setup_image_chooser (PanelPropertiesDialog *dialog, |
| 387 | CtkBuilder *gui) |
| 388 | { |
| 389 | char *image; |
| 390 | |
| 391 | 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 ())))))); |
| 392 | 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 ( )))))))); |
| 393 | |
| 394 | image = panel_profile_get_background_image (dialog->toplevel); |
| 395 | |
| 396 | if (PANEL_GLIB_STR_EMPTY (image)((image) == ((void*)0) || (image)[0] == '\0')) |
| 397 | 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 ( )))))))); |
| 398 | else |
| 399 | 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 ( ))))))), |
| 400 | image); |
| 401 | |
| 402 | if (image) |
| 403 | g_free (image); |
| 404 | |
| 405 | dialog->selection_emitted = 0; |
| 406 | 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) |
| 407 | 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) |
| 408 | dialog)g_signal_connect_data ((dialog->image_chooser), ("selection-changed" ), (((GCallback) (panel_properties_dialog_image_changed))), ( dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 409 | |
| 410 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "image")) { |
| 411 | ctk_widget_set_sensitive (dialog->image_chooser, FALSE(0)); |
| 412 | ctk_widget_show (dialog->writability_warn_background); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | static void |
| 417 | panel_properties_dialog_opacity_changed (PanelPropertiesDialog *dialog) |
| 418 | { |
| 419 | gdouble percentage; |
| 420 | guint16 opacity; |
| 421 | |
| 422 | 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 ()))))) )); |
| 423 | |
| 424 | if (percentage >= 98) |
| 425 | percentage = 100; |
| 426 | else if (percentage <= 2) |
| 427 | percentage = 0; |
| 428 | |
| 429 | opacity = (percentage / 100) * 65535; |
| 430 | |
| 431 | panel_profile_set_background_opacity (dialog->toplevel, opacity); |
| 432 | } |
| 433 | |
| 434 | static void |
| 435 | panel_properties_dialog_setup_opacity_scale (PanelPropertiesDialog *dialog, |
| 436 | CtkBuilder *gui) |
| 437 | { |
| 438 | guint16 opacity; |
| 439 | gdouble percentage; |
| 440 | |
| 441 | 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 ())))))); |
| 442 | 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 ); |
| 443 | 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 ())))))); |
| 444 | 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 ); |
| 445 | 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 ())))))); |
| 446 | 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); |
| 447 | |
| 448 | opacity = panel_profile_get_background_opacity (dialog->toplevel); |
| 449 | |
| 450 | percentage = (opacity * 100.0) / 65535; |
| 451 | |
| 452 | 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); |
| 453 | |
| 454 | 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) |
| 455 | 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) |
| 456 | dialog)g_signal_connect_data ((dialog->opacity_scale), ("value_changed" ), (((GCallback) (panel_properties_dialog_opacity_changed))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 457 | |
| 458 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "opacity")) { |
| 459 | ctk_widget_set_sensitive (dialog->opacity_scale, FALSE(0)); |
| 460 | ctk_widget_set_sensitive (dialog->opacity_label, FALSE(0)); |
| 461 | ctk_widget_set_sensitive (dialog->opacity_legend, FALSE(0)); |
| 462 | ctk_widget_show (dialog->writability_warn_background); |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | static void |
| 467 | panel_properties_dialog_upd_sensitivity (PanelPropertiesDialog *dialog, |
| 468 | PanelBackgroundType background_type) |
| 469 | { |
| 470 | ctk_widget_set_sensitive (dialog->color_widgets, |
| 471 | background_type == PANEL_BACK_COLOR); |
| 472 | ctk_widget_set_sensitive (dialog->image_widgets, |
| 473 | background_type == PANEL_BACK_IMAGE); |
| 474 | } |
| 475 | |
| 476 | static void |
| 477 | panel_properties_dialog_background_toggled (PanelPropertiesDialog *dialog, |
| 478 | CtkWidget *radio) |
| 479 | { |
| 480 | PanelBackgroundType background_type = PANEL_BACK_NONE; |
| 481 | |
| 482 | if (!ctk_toggle_button_get_active (CTK_TOGGLE_BUTTON (radio)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((radio)), ((ctk_toggle_button_get_type ())))))))) |
| 483 | return; |
| 484 | |
| 485 | if (radio == dialog->default_radio) |
| 486 | background_type = PANEL_BACK_NONE; |
| 487 | |
| 488 | else if (radio == dialog->color_radio) |
| 489 | background_type = PANEL_BACK_COLOR; |
| 490 | |
| 491 | else if (radio == dialog->image_radio) |
| 492 | background_type = PANEL_BACK_IMAGE; |
| 493 | |
| 494 | panel_properties_dialog_upd_sensitivity (dialog, background_type); |
| 495 | |
| 496 | panel_profile_set_background_type (dialog->toplevel, background_type); |
| 497 | } |
| 498 | |
| 499 | static void |
| 500 | panel_properties_dialog_setup_background_radios (PanelPropertiesDialog *dialog, |
| 501 | CtkBuilder *gui) |
| 502 | { |
| 503 | PanelBackgroundType background_type; |
| 504 | CtkWidget *active_radio; |
| 505 | |
| 506 | 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 ())))))); |
| 507 | 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 ())))))); |
| 508 | 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 ())))))); |
| 509 | 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 ())))))); |
| 510 | 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 ())))))); |
| 511 | |
| 512 | background_type = panel_profile_get_background_type (dialog->toplevel); |
| 513 | switch (background_type) { |
| 514 | case PANEL_BACK_NONE: |
| 515 | active_radio = dialog->default_radio; |
| 516 | break; |
| 517 | case PANEL_BACK_COLOR: |
| 518 | active_radio = dialog->color_radio; |
| 519 | break; |
| 520 | case PANEL_BACK_IMAGE: |
| 521 | active_radio = dialog->image_radio; |
| 522 | break; |
| 523 | default: |
| 524 | active_radio = NULL((void*)0); |
| 525 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c" , 525, ((const char*) (__func__)), ((void*)0)); } while (0); |
| 526 | } |
| 527 | |
| 528 | 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))); |
| 529 | |
| 530 | panel_properties_dialog_upd_sensitivity (dialog, background_type); |
| 531 | |
| 532 | 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) |
| 533 | 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) |
| 534 | dialog)g_signal_connect_data ((dialog->default_radio), ("toggled" ), (((GCallback) (panel_properties_dialog_background_toggled) )), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 535 | 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) |
| 536 | 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) |
| 537 | dialog)g_signal_connect_data ((dialog->color_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 538 | 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) |
| 539 | 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) |
| 540 | dialog)g_signal_connect_data ((dialog->image_radio), ("toggled"), (((GCallback) (panel_properties_dialog_background_toggled))) , (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 541 | |
| 542 | if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "type")) { |
| 543 | ctk_widget_set_sensitive (dialog->default_radio, FALSE(0)); |
| 544 | ctk_widget_set_sensitive (dialog->color_radio, FALSE(0)); |
| 545 | ctk_widget_set_sensitive (dialog->image_radio, FALSE(0)); |
| 546 | ctk_widget_show (dialog->writability_warn_background); |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | static void |
| 551 | panel_properties_update_arrows_toggle_visible (PanelPropertiesDialog *dialog, |
| 552 | CtkToggleButton *toggle) |
| 553 | { |
| 554 | if (ctk_toggle_button_get_active (toggle)) |
| 555 | ctk_widget_set_sensitive (dialog->arrows_toggle, |
| 556 | panel_profile_key_is_writable (dialog->toplevel, PANEL_TOPLEVEL_ENABLE_ARROWS_KEY"enable-arrows")); |
| 557 | else |
| 558 | ctk_widget_set_sensitive (dialog->arrows_toggle, FALSE(0)); |
| 559 | } |
| 560 | |
| 561 | static void |
| 562 | panel_properties_dialog_response (PanelPropertiesDialog *dialog, |
| 563 | int response, |
| 564 | CtkWidget *properties_dialog) |
| 565 | { |
| 566 | char *help_id; |
| 567 | |
| 568 | switch (response) { |
| 569 | case CTK_RESPONSE_CLOSE: |
| 570 | ctk_widget_destroy (properties_dialog); |
| 571 | break; |
| 572 | case CTK_RESPONSE_HELP: |
| 573 | if (panel_toplevel_get_is_attached (dialog->toplevel)) { |
| 574 | help_id = "gospanel-550"; |
| 575 | } else { |
| 576 | help_id = "gospanel-28"; |
| 577 | } |
| 578 | 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 ()))))))), |
| 579 | "cafe-user-guide", help_id, NULL((void*)0)); |
| 580 | break; |
| 581 | default: |
| 582 | break; |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | static void |
| 587 | panel_properties_dialog_destroy (PanelPropertiesDialog *dialog) |
| 588 | { |
| 589 | panel_toplevel_pop_autohide_disabler (PANEL_TOPLEVEL (dialog->toplevel)((((PanelToplevel*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->toplevel)), ((panel_toplevel_get_type ()))))) )); |
| 590 | g_object_set_qdata (G_OBJECT (dialog->toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->toplevel)), (((GType) ((20) << (2)))))) )), |
| 591 | panel_properties_dialog_quark, |
| 592 | NULL((void*)0)); |
| 593 | } |
| 594 | |
| 595 | static void |
| 596 | panel_properties_dialog_update_orientation (PanelPropertiesDialog *dialog, |
| 597 | PanelOrientation orientation) |
| 598 | { |
| 599 | CtkTreeModel *model; |
| 600 | CtkTreeIter iter; |
| 601 | OrientationComboItem *item; |
| 602 | int max_size; |
| 603 | int spin_size; |
| 604 | int profile_size; |
| 605 | |
| 606 | /* change the maximum size of the panel */ |
| 607 | //TODO: we should also do this when the monitor size changes |
| 608 | max_size = panel_toplevel_get_maximum_size (dialog->toplevel); |
| 609 | 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 ()))) )))); |
| 610 | profile_size = panel_profile_get_toplevel_size (dialog->toplevel); |
| 611 | |
| 612 | 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 ()))) ))), |
| 613 | panel_toplevel_get_minimum_size (dialog->toplevel), |
| 614 | max_size); |
| 615 | |
| 616 | if (spin_size > max_size) |
| 617 | 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 ()))) ))), |
| 618 | max_size); |
| 619 | else if (spin_size != profile_size) |
| 620 | 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 ()))) ))), |
| 621 | MIN (profile_size, max_size)(((profile_size) < (max_size)) ? (profile_size) : (max_size ))); |
| 622 | |
| 623 | /* update the orientation combo box */ |
| 624 | 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 ()))))))); |
| 625 | |
| 626 | if (!ctk_tree_model_get_iter_first (model, &iter)) |
| 627 | return; |
| 628 | |
| 629 | do { |
| 630 | ctk_tree_model_get (model, &iter, COLUMN_ITEM, &item, -1); |
| 631 | if (item != NULL((void*)0) && item->orientation == orientation) { |
| 632 | 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 ())))))), |
| 633 | &iter); |
| 634 | return; |
| 635 | } |
| 636 | } while (ctk_tree_model_iter_next (model, &iter)); |
| 637 | } |
| 638 | |
| 639 | static void |
| 640 | panel_properties_dialog_update_size (PanelPropertiesDialog *dialog, |
| 641 | int size) |
| 642 | { |
| 643 | 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); |
| 644 | } |
| 645 | |
| 646 | static void |
| 647 | panel_properties_dialog_toplevel_notify (GSettings *settings, |
| 648 | gchar *key, |
| 649 | PanelPropertiesDialog *dialog) |
| 650 | { |
| 651 | |
| 652 | #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); } \ |
| 653 | if (!strcmp (key, p)) { \ |
| 654 | gboolean val = g_settings_get_boolean (settings, key); \ |
| 655 | 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) \ |
| 656 | 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); \ |
| 657 | } |
| 658 | |
| 659 | if (!strcmp (key, "orientation")) |
| 660 | panel_properties_dialog_update_orientation (dialog, g_settings_get_enum (settings, key)); |
| 661 | else if (!strcmp (key, "size")) |
| 662 | panel_properties_dialog_update_size (dialog, g_settings_get_int (settings, key)); |
| 663 | 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); } |
| 664 | 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); } |
| 665 | 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); } |
| 666 | 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); } |
| 667 | } |
| 668 | |
| 669 | static void |
| 670 | panel_properties_dialog_update_background_type (PanelPropertiesDialog *dialog, |
| 671 | PanelBackgroundType background_type) |
| 672 | { |
| 673 | CtkWidget *active_radio; |
| 674 | |
| 675 | switch (background_type) { |
| 676 | case PANEL_BACK_NONE: |
| 677 | active_radio = dialog->default_radio; |
| 678 | break; |
| 679 | case PANEL_BACK_COLOR: |
| 680 | active_radio = dialog->color_radio; |
| 681 | break; |
| 682 | case PANEL_BACK_IMAGE: |
| 683 | active_radio = dialog->image_radio; |
| 684 | break; |
| 685 | default: |
| 686 | active_radio = NULL((void*)0); |
| 687 | g_assert_not_reached ()do { g_assertion_message_expr (((gchar*) 0), "panel-properties-dialog.c" , 687, ((const char*) (__func__)), ((void*)0)); } while (0); |
| 688 | break; |
| 689 | } |
| 690 | |
| 691 | 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))); |
| 692 | } |
| 693 | |
| 694 | static void |
| 695 | panel_properties_dialog_update_background_color (PanelPropertiesDialog *dialog, |
| 696 | gchar *str_color) |
| 697 | { |
| 698 | CdkRGBA new_color; |
| 699 | CdkRGBA old_color; |
| 700 | |
| 701 | if (!cdk_rgba_parse (&new_color, str_color)) |
| 702 | return; |
| 703 | |
| 704 | 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 ( ))))))), |
| 705 | &old_color); |
| 706 | |
| 707 | if (!cdk_rgba_equal (&old_color, &new_color)) |
| 708 | 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 ( ))))))), |
| 709 | &new_color); |
| 710 | } |
| 711 | |
| 712 | static void |
| 713 | panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, |
| 714 | gchar *text) |
| 715 | { |
| 716 | char *old_text; |
| 717 | |
| 718 | 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 ( )))))))); |
| 719 | |
| 720 | if (PANEL_GLIB_STR_EMPTY (text)((text) == ((void*)0) || (text)[0] == '\0') && old_text) |
| 721 | 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 ( )))))))); |
| 722 | else if (!PANEL_GLIB_STR_EMPTY (text)((text) == ((void*)0) || (text)[0] == '\0') && |
| 723 | (!old_text || strcmp (text, old_text))) |
| 724 | 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 ( ))))))), |
| 725 | text); |
| 726 | |
| 727 | if (old_text) |
| 728 | g_free (old_text); |
| 729 | } |
| 730 | |
| 731 | static void |
| 732 | panel_properties_dialog_background_notify (GSettings *settings, |
| 733 | gchar *key, |
| 734 | PanelPropertiesDialog *dialog) |
| 735 | { |
| 736 | if (!strcmp (key, "type")) |
| 737 | { |
| 738 | PanelBackgroundType type = g_settings_get_enum (settings, key); |
| 739 | panel_properties_dialog_update_background_type (dialog, type); |
| 740 | } |
| 741 | else if (!strcmp (key, "color")) |
| 742 | { |
| 743 | char *color = g_settings_get_string (settings, key); |
| 744 | panel_properties_dialog_update_background_color (dialog, color); |
| 745 | g_free (color); |
| 746 | } |
| 747 | else if (!strcmp (key, "image")) |
| 748 | { |
| 749 | char *image = g_settings_get_string (settings, key); |
| 750 | panel_properties_dialog_update_background_image (dialog, image); |
| 751 | g_free (image); |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | static void |
| 756 | panel_properties_dialog_remove_orientation_combo (PanelPropertiesDialog *dialog) |
| 757 | { |
| 758 | CtkContainer *container = CTK_CONTAINER (dialog->general_table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_container_get_type ()) ))))); |
| 759 | CtkGrid *grid = CTK_GRID (dialog->general_table)((((CtkGrid*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_grid_get_type ())))))); |
| 760 | |
| 761 | g_object_ref (dialog->size_label)((__typeof__ (dialog->size_label)) (g_object_ref) (dialog-> size_label)); |
| 762 | g_object_ref (dialog->size_widgets)((__typeof__ (dialog->size_widgets)) (g_object_ref) (dialog ->size_widgets)); |
| 763 | g_object_ref (dialog->icon_label)((__typeof__ (dialog->icon_label)) (g_object_ref) (dialog-> icon_label)); |
| 764 | g_object_ref (dialog->icon_align)((__typeof__ (dialog->icon_align)) (g_object_ref) (dialog-> icon_align)); |
| 765 | |
| 766 | ctk_container_remove (container, dialog->orientation_label); |
| 767 | ctk_container_remove (container, dialog->orientation_combo); |
| 768 | ctk_container_remove (container, dialog->size_label); |
| 769 | ctk_container_remove (container, dialog->size_widgets); |
| 770 | ctk_container_remove (container, dialog->icon_label); |
| 771 | ctk_container_remove (container, dialog->icon_align); |
| 772 | |
| 773 | ctk_grid_attach (grid, dialog->size_label, 0, 1, 1, 1); |
| 774 | ctk_grid_attach (grid, dialog->size_widgets, 1, 1, 1, 1); |
| 775 | ctk_grid_attach (grid, dialog->icon_label, 0, 2, 1, 1); |
| 776 | ctk_grid_attach (grid, dialog->icon_align, 1, 2, 1, 1); |
| 777 | |
| 778 | dialog->orientation_label = NULL((void*)0); |
| 779 | dialog->orientation_combo = NULL((void*)0); |
| 780 | g_object_unref (dialog->size_label); |
| 781 | g_object_unref (dialog->size_widgets); |
| 782 | g_object_unref (dialog->icon_label); |
| 783 | g_object_unref (dialog->icon_align); |
| 784 | } |
| 785 | |
| 786 | static void |
| 787 | panel_properties_dialog_remove_icon_chooser (PanelPropertiesDialog *dialog) |
| 788 | { |
| 789 | CtkContainer *container = CTK_CONTAINER (dialog->general_table)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_table)), ((ctk_container_get_type ()) ))))); |
| 790 | |
| 791 | ctk_container_remove (container, dialog->icon_label); |
| 792 | ctk_container_remove (container, dialog->icon_align); |
| 793 | |
| 794 | dialog->icon_label = NULL((void*)0); |
| 795 | dialog->icon_align = NULL((void*)0); |
| 796 | dialog->icon_chooser = NULL((void*)0); |
| 797 | } |
| 798 | |
| 799 | static void |
| 800 | panel_properties_dialog_remove_toggles (PanelPropertiesDialog *dialog) |
| 801 | { |
| 802 | CtkContainer *container = CTK_CONTAINER (dialog->general_vbox)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->general_vbox)), ((ctk_container_get_type ())) )))); |
| 803 | |
| 804 | ctk_container_remove (container, dialog->autohide_toggle); |
| 805 | ctk_container_remove (container, dialog->expand_toggle); |
| 806 | |
| 807 | dialog->autohide_toggle = NULL((void*)0); |
| 808 | dialog->expand_toggle = NULL((void*)0); |
| 809 | } |
| 810 | |
| 811 | static void |
| 812 | panel_properties_dialog_update_for_attached (PanelPropertiesDialog *dialog, |
| 813 | gboolean attached) |
| 814 | { |
| 815 | if (!attached) |
| 816 | panel_properties_dialog_remove_icon_chooser (dialog); |
| 817 | else { |
| 818 | ctk_window_set_title (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
| 819 | _("Drawer Properties")gettext ("Drawer Properties")); |
| 820 | panel_properties_dialog_remove_toggles (dialog); |
| 821 | panel_properties_dialog_remove_orientation_combo (dialog); |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | static PanelPropertiesDialog * |
| 826 | panel_properties_dialog_new (PanelToplevel *toplevel, |
| 827 | CtkBuilder *gui) |
| 828 | { |
| 829 | PanelPropertiesDialog *dialog; |
| 830 | char *toplevel_settings_path; |
| 831 | |
| 832 | dialog = g_new0 (PanelPropertiesDialog, 1)((PanelPropertiesDialog *) g_malloc0_n ((1), sizeof (PanelPropertiesDialog ))); |
| 833 | |
| 834 | g_object_set_qdata_full (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), |
| 835 | panel_properties_dialog_quark, |
| 836 | dialog, |
| 837 | (GDestroyNotify) panel_properties_dialog_free); |
| 838 | |
| 839 | dialog->toplevel = toplevel; |
| 840 | |
| 841 | 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 ())))))); |
| 842 | 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) |
| 843 | 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); |
| 844 | 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) |
| 845 | 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); |
| 846 | |
| 847 | ctk_window_set_screen (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
| 848 | ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))))); |
| 849 | |
| 850 | 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 ())))))); |
| 851 | 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 ())))))); |
| 852 | |
| 853 | 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 ())))))); |
| 854 | 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 ())))))); |
| 855 | |
| 856 | panel_properties_dialog_setup_orientation_combo (dialog, gui); |
| 857 | panel_properties_dialog_setup_size_spin (dialog, gui); |
| 858 | panel_properties_dialog_setup_icon_chooser (dialog, gui); |
| 859 | panel_properties_dialog_setup_expand_toggle (dialog, gui); |
| 860 | panel_properties_dialog_setup_autohide_toggle (dialog, gui); |
| 861 | panel_properties_dialog_setup_hidebuttons_toggle (dialog, gui); |
| 862 | panel_properties_dialog_setup_arrows_toggle (dialog, gui); |
| 863 | |
| 864 | 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) |
| 865 | 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); |
| 866 | |
| 867 | panel_properties_update_arrows_toggle_visible ( |
| 868 | dialog, CTK_TOGGLE_BUTTON (dialog->hidebuttons_toggle)((((CtkToggleButton*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->hidebuttons_toggle)), ((ctk_toggle_button_get_type ()))))))); |
| 869 | 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) |
| 870 | 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) |
| 871 | dialog)g_signal_connect_data ((dialog->hidebuttons_toggle), ("toggled" ), (((GCallback) (panel_properties_update_arrows_toggle_visible ))), (dialog), ((void*)0), G_CONNECT_SWAPPED); |
| 872 | |
| 873 | g_object_get (toplevel, "settings-path", &toplevel_settings_path, NULL((void*)0)); |
| 874 | dialog->settings = g_settings_new_with_path (PANEL_TOPLEVEL_SCHEMA"org.cafe.panel.toplevel", |
| 875 | toplevel_settings_path); |
| 876 | gchar *toplevel_background_path; |
| 877 | toplevel_background_path = g_strdup_printf ("%sbackground/", toplevel_settings_path); |
| 878 | dialog->background_settings = g_settings_new_with_path (PANEL_TOPLEVEL_BACKGROUND_SCHEMA"org.cafe.panel.toplevel.background", |
| 879 | toplevel_background_path); |
| 880 | g_free (toplevel_background_path); |
| 881 | g_free (toplevel_settings_path); |
| 882 | |
| 883 | g_signal_connect (dialog->settings,g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0) |
| 884 | "changed",g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0) |
| 885 | 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) |
| 886 | dialog)g_signal_connect_data ((dialog->settings), ("changed"), (( (GCallback) (panel_properties_dialog_toplevel_notify))), (dialog ), ((void*)0), (GConnectFlags) 0); |
| 887 | |
| 888 | panel_properties_dialog_setup_color_button (dialog, gui); |
| 889 | panel_properties_dialog_setup_image_chooser (dialog, gui); |
| 890 | panel_properties_dialog_setup_opacity_scale (dialog, gui); |
| 891 | panel_properties_dialog_setup_background_radios (dialog, gui); |
| 892 | |
| 893 | 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) |
| 894 | "changed",g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0) |
| 895 | 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) |
| 896 | dialog)g_signal_connect_data ((dialog->background_settings), ("changed" ), (((GCallback) (panel_properties_dialog_background_notify)) ), (dialog), ((void*)0), (GConnectFlags) 0); |
| 897 | |
| 898 | panel_properties_dialog_update_for_attached (dialog, |
| 899 | panel_toplevel_get_is_attached (dialog->toplevel)); |
| 900 | |
| 901 | panel_toplevel_push_autohide_disabler (dialog->toplevel); |
| 902 | panel_widget_register_open_dialog (panel_toplevel_get_panel_widget (dialog->toplevel), |
| 903 | dialog->properties_dialog); |
| 904 | |
| 905 | ctk_widget_show (dialog->properties_dialog); |
| 906 | |
| 907 | return dialog; |
| 908 | } |
| 909 | |
| 910 | void |
| 911 | panel_properties_dialog_present (PanelToplevel *toplevel) |
| 912 | { |
| 913 | PanelPropertiesDialog *dialog; |
| 914 | CtkBuilder *gui; |
| 915 | |
| 916 | if (!panel_properties_dialog_quark) |
| 917 | panel_properties_dialog_quark = |
| 918 | g_quark_from_static_string ("panel-properties-dialog"); |
| 919 | |
| 920 | dialog = g_object_get_qdata (G_OBJECT (toplevel)((((GObject*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), (((GType) ((20) << (2)))))))), panel_properties_dialog_quark); |
| 921 | if (dialog) { |
| 922 | ctk_window_set_screen (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () )))))), |
| 923 | ctk_window_get_screen (CTK_WINDOW (toplevel)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((toplevel)), ((ctk_window_get_type ())))))))); |
| 924 | ctk_window_present (CTK_WINDOW (dialog->properties_dialog)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance *) ((dialog->properties_dialog)), ((ctk_window_get_type () ))))))); |
| 925 | return; |
| 926 | } |
| 927 | |
| 928 | gui = ctk_builder_new (); |
| 929 | ctk_builder_set_translation_domain (gui, GETTEXT_PACKAGE"cafe-panel"); |
| 930 | ctk_builder_add_from_resource (gui, |
| 931 | PANEL_RESOURCE_PATH"/org/cafe/panel/" "panel-properties-dialog.ui", |
| 932 | NULL((void*)0)); |
| 933 | |
| 934 | dialog = panel_properties_dialog_new (toplevel, gui); |
Value stored to 'dialog' is never read | |
| 935 | |
| 936 | g_object_unref (gui); |
| 937 | } |