static void eog_application_init_app_menu (EogApplication *application) { EogApplicationPrivate *priv = application->priv; GtkBuilder *builder; GError *error = NULL; GAction *action; g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application); builder = gtk_builder_new (); gtk_builder_add_from_file (builder, EOG_DATA_DIR"/eog-app-menu.xml", &error); if (error == NULL) { gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu"))); } else { g_critical ("Unable to add the application menu: %s\n", error->message); g_error_free (error); } action = g_action_map_lookup_action (G_ACTION_MAP (application), "view-gallery"); g_settings_bind_with_mapping (priv->ui_settings, EOG_CONF_UI_IMAGE_GALLERY, action, "state", G_SETTINGS_BIND_DEFAULT, _settings_map_get_bool_variant, _settings_map_set_variant, NULL, NULL); action = g_action_map_lookup_action (G_ACTION_MAP (application), "toolbar"); g_settings_bind_with_mapping (priv->ui_settings, EOG_CONF_UI_TOOLBAR, action, "state", G_SETTINGS_BIND_DEFAULT, _settings_map_get_bool_variant, _settings_map_set_variant, NULL, NULL); action = g_action_map_lookup_action (G_ACTION_MAP (application), "view-sidebar"); g_settings_bind_with_mapping (priv->ui_settings, EOG_CONF_UI_SIDEBAR, action, "state", G_SETTINGS_BIND_DEFAULT, _settings_map_get_bool_variant, _settings_map_set_variant, NULL, NULL); action = g_action_map_lookup_action (G_ACTION_MAP (application), "view-statusbar"); g_settings_bind_with_mapping (priv->ui_settings, EOG_CONF_UI_STATUSBAR, action, "state", G_SETTINGS_BIND_DEFAULT, _settings_map_get_bool_variant, _settings_map_set_variant, NULL, NULL); g_object_unref (builder); }
static void cc_ua_panel_init_seeing (CcUaPanel *self) { CcUaPanelPrivate *priv = self->priv; g_settings_bind_with_mapping (priv->interface_settings, KEY_GTK_THEME, WID (priv->builder, "seeing_contrast_switch"), "active", G_SETTINGS_BIND_DEFAULT, get_contrast_mapping, set_contrast_mapping, self, NULL); g_settings_bind_with_mapping (priv->interface_settings, KEY_TEXT_SCALING_FACTOR, WID (priv->builder, "seeing_large_text_switch"), "active", G_SETTINGS_BIND_DEFAULT, get_large_text_mapping, set_large_text_mapping, priv->interface_settings, NULL); g_settings_bind (priv->kb_settings, "togglekeys-enable", WID (priv->builder, "seeing_toggle_keys_switch"), "active", G_SETTINGS_BIND_DEFAULT); priv->shell_watch_id = g_bus_watch_name (G_BUS_TYPE_SESSION, "org.gnome.Shell", G_BUS_NAME_WATCHER_FLAGS_NONE, (GBusNameAppearedCallback) shell_appeared_cb, (GBusNameVanishedCallback) shell_vanished_cb, self, NULL); g_signal_connect (WID (priv->builder, "seeing_zoom_preferences_button"), "clicked", G_CALLBACK (zoom_options_launch_cb), self); g_settings_bind (priv->application_settings, "screen-magnifier-enabled", WID (priv->builder, "seeing_zoom_switch"), "active", G_SETTINGS_BIND_DEFAULT); settings_on_off_editor_new (priv, priv->application_settings, "screen-reader-enabled", WID (priv->builder, "seeing_reader_switch"), NULL); cc_ua_panel_set_shortcut_label (self, "seeing_zoom_enable_keybinding_label", "magnifier"); cc_ua_panel_set_shortcut_label (self, "seeing_zoom_in_keybinding_label", "magnifier-zoom-in"); cc_ua_panel_set_shortcut_label (self, "seeing_zoom_out_keybinding_label", "magnifier-zoom-out"); cc_ua_panel_set_shortcut_label (self, "seeing_reader_enable_keybinding_label", "screenreader"); }
static void mud_character_constructed (GObject *object) { gchar *character_path; MudCharacter *self = (MudCharacter *)object; G_OBJECT_CLASS (mud_character_parent_class)->constructed (object); /* TODO: Change ID property to default to G_MAXUINT64 and figure out a new ID to use here, instead of caller having to do it */ character_path = g_strdup_printf("/org/gnome/MUD/Characters/%s/", self->id); self->settings = g_settings_new_with_path("org.gnome.MUD.Character", character_path); /* TODO: Reaction to MUD/Profile changes; but maybe this binding to other objects 'id' is enough? */ /* FIXME: For now just setting mud/profile names for the benefit of new freshly created characters; think this through more and maybe do elsewhere, as during load we'd get that value already too and figure it out in manager */ g_settings_bind_with_mapping (self->settings, "profile", self->profile, "id", G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY, NULL, _set_profile_id_mapping, /* TODO: Get rid of the mapping once we have converted profile over to use full name instead of integer ID too */ NULL, NULL); g_settings_bind (self->settings, "mud", self->mud, "id", G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind (self->settings, "name", self, "name", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind (self->settings, "connect-string", self, "connect-string", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); g_free (character_path); }
static void place_query_info_ready (GObject *source, GAsyncResult *res, gpointer user_data) { GtkWidget *row, *box, *w; Place *place; GFileInfo *info; const gchar *desktop_path; gchar *path; info = g_file_query_info_finish (G_FILE (source), res, NULL); if (!info) return; row = user_data; place = g_object_get_data (G_OBJECT (row), "place"); g_clear_object (&place->cancellable); box = gtk_bin_get_child (GTK_BIN (row)); /* FIXME: GLib is currently buggy and returns a non-existent icon name * when asked for the desktop symbolic icon. */ desktop_path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP); path = g_file_get_path (G_FILE (source)); if (g_strcmp0 (path, desktop_path) == 0) place->icon = g_themed_icon_new ("folder-symbolic"); else place->icon = g_object_ref (g_file_info_get_symbolic_icon (info)); if (g_strcmp0 (path, g_get_home_dir ()) == 0) place->settings_key = TRACKER_KEY_SINGLE_DIRECTORIES; else place->settings_key = TRACKER_KEY_RECURSIVE_DIRECTORIES; g_free (path); w = gtk_image_new_from_gicon (place->icon, GTK_ICON_SIZE_MENU); gtk_container_add (GTK_CONTAINER (box), w); w = gtk_label_new (place->display_name); gtk_container_add (GTK_CONTAINER (box), w); w = gtk_switch_new (); gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0); g_settings_bind_with_mapping (tracker_preferences, place->settings_key, w, "active", G_SETTINGS_BIND_DEFAULT, switch_tracker_get_mapping, switch_tracker_set_mapping, place, NULL); gtk_widget_show_all (row); g_object_unref (info); }
static void ide_editor_frame_init (IdeEditorFrame *self) { g_autoptr(GSettings) settings = NULL; g_autoptr(GSettings) insight_settings = NULL; GtkTargetList *target_list; gtk_widget_init_template (GTK_WIDGET (self)); ide_editor_frame_actions_init (self); settings = g_settings_new ("org.gnome.builder.editor"); g_settings_bind (settings, "draw-spaces", self->source_view, "draw-spaces", G_SETTINGS_BIND_DEFAULT); g_settings_bind (settings, "font-name", self->source_view, "font-name", G_SETTINGS_BIND_GET); g_settings_bind (settings, "highlight-current-line", self->source_view, "highlight-current-line", G_SETTINGS_BIND_GET); g_settings_bind (settings, "overscroll", self->source_view, "overscroll", G_SETTINGS_BIND_GET); g_settings_bind (settings, "scroll-offset", self->source_view, "scroll-offset", G_SETTINGS_BIND_GET); g_settings_bind (settings, "show-grid-lines", self->source_view, "show-grid-lines", G_SETTINGS_BIND_GET); g_settings_bind (settings, "show-line-changes", self->source_view, "show-line-changes", G_SETTINGS_BIND_GET); g_settings_bind (settings, "show-line-numbers", self->source_view, "show-line-numbers", G_SETTINGS_BIND_GET); g_settings_bind (settings, "smart-backspace", self->source_view, "smart-backspace", G_SETTINGS_BIND_GET); g_settings_bind_with_mapping (settings, "smart-home-end", self->source_view, "smart-home-end", G_SETTINGS_BIND_GET, get_smart_home_end, NULL, NULL, NULL); g_settings_bind (settings, "show-map", self, "show-map", G_SETTINGS_BIND_GET); g_settings_bind (settings, "auto-hide-map", self, "auto-hide-map", G_SETTINGS_BIND_GET); g_signal_connect_object (settings, "changed::keybindings", G_CALLBACK (keybindings_changed), self, 0); insight_settings = g_settings_new ("org.gnome.builder.code-insight"); g_settings_bind (insight_settings, "word-completion", self->source_view, "enable-word-completion", G_SETTINGS_BIND_GET); g_signal_connect_object (self->source_view, "notify::overwrite", G_CALLBACK (ide_editor_frame_update_ruler), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->source_view, "notify::mode-display-name", G_CALLBACK (ide_editor_frame_update_ruler), self, G_CONNECT_SWAPPED); /* * we want to rubberbanding search until enter has been pressed or next/previous actions * have been activated. */ g_object_bind_property (self->search_revealer, "visible", self->source_view, "rubberband-search", G_BINDING_SYNC_CREATE); /* * Drag and drop support */ target_list = gtk_drag_dest_get_target_list (GTK_WIDGET (self->source_view)); if (target_list) gtk_target_list_add_uri_targets (target_list, TARGET_URI_LIST); }
static void cc_ua_panel_init_hearing (CcUaPanel *self) { CcUaPanelPrivate *priv = self->priv; GtkWidget *list; GtkWidget *dialog; list = WID ("list_hearing"); add_section (list, self); add_separators (GTK_LIST_BOX (list)); g_signal_connect_swapped (list, "row-activated", G_CALLBACK (activate_row), self); /* set the initial visual bell values */ visual_bell_type_notify_cb (NULL, NULL, self); /* and listen */ g_settings_bind (priv->wm_settings, KEY_VISUAL_BELL_ENABLED, WID ("visual_alerts_switch"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind_with_mapping (priv->wm_settings, KEY_VISUAL_BELL_ENABLED, WID ("value_visual_alerts"), "label", G_SETTINGS_BIND_GET, on_off_label_mapping_get, NULL, NULL, NULL); g_object_bind_property (WID ("visual_alerts_switch"), "active", WID ("visual_alerts_window_radio"), "sensitive", G_BINDING_SYNC_CREATE); g_object_bind_property (WID ("visual_alerts_switch"), "active", WID ("visual_alerts_screen_radio"), "sensitive", G_BINDING_SYNC_CREATE); g_signal_connect (priv->wm_settings, "changed::" KEY_VISUAL_BELL_TYPE, G_CALLBACK (visual_bell_type_notify_cb), self); g_signal_connect (WID ("visual_alerts_window_radio"), "toggled", G_CALLBACK (visual_bell_type_toggle_cb), self); dialog = WID ("visual_alerts_dialog"); g_object_set_data (G_OBJECT (WID ("row_visual_alerts")), "dialog", dialog); g_signal_connect_swapped (WID ("visual_alerts_done"), "clicked", G_CALLBACK (gtk_widget_hide), dialog); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); g_signal_connect (WID ("visual_alerts_test_button"), "clicked", G_CALLBACK (gdk_beep), NULL); g_signal_connect (WID ("heading_visual_alerts"), "mnemonic-activate", G_CALLBACK (mnemonic_activate), self); }
void empathy_webkit_bind_font_setting (WebKitWebView *webview, GSettings *gsettings, const char *key) { WebKitWebSettings *settings = webkit_web_view_get_settings (webview); g_settings_bind_with_mapping (gsettings, key, settings, "default-font-family", G_SETTINGS_BIND_GET, webkit_get_font_family, NULL, NULL, NULL); g_settings_bind_with_mapping (gsettings, key, settings, "default-font-size", G_SETTINGS_BIND_GET, webkit_get_font_size, NULL, NULL, NULL); }
static void settings_mail_formatter_constructed (GObject *object) { ESettingsMailFormatter *extension; EMailFormatter *formatter; GSettings *settings; extension = E_SETTINGS_MAIL_FORMATTER (object); formatter = settings_mail_formatter_get_extensible (extension); settings = g_settings_new ("org.gnome.evolution.mail"); g_settings_bind_with_mapping ( settings, "citation-color", formatter, "citation-color", G_SETTINGS_BIND_GET, settings_mail_formatter_map_string_to_rgba, (GSettingsBindSetMapping) NULL, NULL, (GDestroyNotify) NULL); g_settings_bind ( settings, "mark-citations", formatter, "mark-citations", G_SETTINGS_BIND_GET); g_settings_bind ( settings, "image-loading-policy", formatter, "image-loading-policy", G_SETTINGS_BIND_GET); g_settings_bind ( settings, "show-sender-photo", formatter, "show-sender-photo", G_SETTINGS_BIND_GET); g_settings_bind ( settings, "show-real-date", formatter, "show-real-date", G_SETTINGS_BIND_GET); g_settings_bind ( settings, "show-animated-images", formatter, "animate-images", G_SETTINGS_BIND_GET); g_object_unref (settings); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_settings_mail_formatter_parent_class)-> constructed (object); }
static void bind_builder_enum (GtkBuilder *builder, GSettings *settings, const char *widget_name, const char *prefs, const char **enum_values) { g_settings_bind_with_mapping (settings, prefs, gtk_builder_get_object (builder, widget_name), "active", G_SETTINGS_BIND_DEFAULT, enum_get_mapping, enum_set_mapping, enum_values, NULL); }
static GtkWidget * get_abrt_label (GSettings *settings, const gchar *key) { GtkWidget *w; w = gtk_label_new (""); g_settings_bind_with_mapping (settings, key, w, "label", G_SETTINGS_BIND_GET, abrt_label_mapping_get, NULL, NULL, NULL); return w; }
static void cc_sharing_panel_setup_bluetooth_sharing_dialog (CcSharingPanel *self) { CcSharingPanelPrivate *priv = self->priv; GSettings *settings; priv->rfkill = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL, "org.gnome.SettingsDaemon.Rfkill", "/org/gnome/SettingsDaemon/Rfkill", "org.gnome.SettingsDaemon.Rfkill", NULL, NULL); if (!priv->rfkill) { /* No rfkill, not Linux */ gtk_widget_hide (WID ("bluetooth-sharing-button")); return; } /* get the initial state */ bluetooth_state_changed (self); g_signal_connect_swapped (priv->rfkill, "g-properties-changed", G_CALLBACK (bluetooth_state_changed), self); cc_sharing_panel_bind_switch_to_label (self, WID ("save-received-files-to-downloads-switch"), WID ("bluetooth-sharing-status-label")); cc_sharing_panel_bind_switch_to_widgets (WID ("save-received-files-to-downloads-switch"), WID ("receive-files-grid"), NULL); settings = g_settings_new (FILE_SHARING_SCHEMA_ID); g_settings_bind (settings, "bluetooth-obexpush-enabled", WID ("save-received-files-to-downloads-switch"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind_with_mapping (settings, "bluetooth-accept-files", WID ("only-receive-from-trusted-devices-switch"), "active", G_SETTINGS_BIND_DEFAULT, bluetooth_get_accept_files, bluetooth_set_accept_files, NULL, NULL); }
/** * rb_source_bind_settings: * @source: the #RBSource * @entry_view: (allow-none): the #RBEntryView for the source * @paned: (allow-none): the #GtkPaned containing the entry view and the browser * @browser: (allow-none): the browser (typically a #RBLibraryBrowser) for the source * * Binds the source's #GSettings instance to the given widgets. Should be called * from the source's constructed method. * * If the browser widget has a browser-views property, it will be bound to the * browser-views settings key. */ void rb_source_bind_settings (RBSource *source, GtkWidget *entry_view, GtkWidget *paned, GtkWidget *browser) { char *name; GSettings *common_settings; common_settings = g_settings_new ("org.gnome.rhythmbox.sources"); g_object_get (source, "name", &name, NULL); if (entry_view != NULL) { rb_debug ("binding entry view sort order for %s", name); if (source->priv->settings) { g_settings_bind_with_mapping (source->priv->settings, "sorting", entry_view, "sort-order", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_NO_SENSITIVITY, (GSettingsBindGetMapping) sort_order_get_mapping, (GSettingsBindSetMapping) sort_order_set_mapping, NULL, NULL); } g_settings_bind (common_settings, "visible-columns", entry_view, "visible-columns", G_SETTINGS_BIND_DEFAULT); } if (paned != NULL && source->priv->settings != NULL) { rb_debug ("binding paned position for %s", name); /* can't use a normal binding here, as we want to delay writing to the * setting while the separator is being dragged. */ g_settings_bind (source->priv->settings, "paned-position", paned, "position", G_SETTINGS_BIND_GET); g_signal_connect_object (paned, "notify::position", G_CALLBACK (paned_position_changed_cb), source->priv->settings, 0); } if (browser) { rb_debug ("binding show-browser for %s", name); if (source->priv->settings) { g_settings_bind (source->priv->settings, "show-browser", source, "show-browser", G_SETTINGS_BIND_DEFAULT); } if (g_object_class_find_property (G_OBJECT_GET_CLASS (browser), "browser-views")) { g_settings_bind (common_settings, "browser-views", browser, "browser-views", G_SETTINGS_BIND_DEFAULT); } } g_free (name); }
static void add_application (CcNotificationsPanel *panel, Application *app) { GtkWidget *box, *w; GIcon *icon; icon = g_app_info_get_icon (app->app_info); if (icon == NULL) icon = g_themed_icon_new ("application-x-executable"); else g_object_ref (icon); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); g_object_set_qdata_full (G_OBJECT (box), application_quark (), app, (GDestroyNotify) application_free); gtk_container_add (GTK_CONTAINER (panel->list_box), box); w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); gtk_widget_set_margin_left (w, 12); gtk_container_add (GTK_CONTAINER (box), w); g_object_unref (icon); w = gtk_label_new (g_app_info_get_name (app->app_info)); gtk_container_add (GTK_CONTAINER (box), w); w = gtk_label_new (""); g_settings_bind_with_mapping (app->settings, "enable", w, "label", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY, on_off_label_mapping_get, NULL, NULL, NULL); gtk_widget_set_margin_right (w, 12); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0); gtk_widget_show_all (box); g_hash_table_add (panel->known_applications, g_strdup (app->canonical_app_id)); }
static void cc_sharing_panel_setup_personal_file_sharing_dialog (CcSharingPanel *self) { CcSharingPanelPrivate *priv = self->priv; GSettings *settings; GtkWidget *networks, *grid, *w; cc_sharing_panel_bind_switch_to_widgets (WID ("personal-file-sharing-require-password-switch"), WID ("personal-file-sharing-password-entry"), WID ("personal-file-sharing-password-label"), NULL); cc_sharing_panel_setup_label_with_hostname (self, WID ("personal-file-sharing-label")); /* the password cannot be read, so just make sure the entry is not empty */ gtk_entry_set_text (GTK_ENTRY (WID ("personal-file-sharing-password-entry")), "password"); settings = g_settings_new (FILE_SHARING_SCHEMA_ID); g_settings_bind_with_mapping (settings, "require-password", WID ("personal-file-sharing-require-password-switch"), "active", G_SETTINGS_BIND_DEFAULT, file_sharing_get_require_password, file_sharing_set_require_password, NULL, NULL); g_signal_connect (WID ("personal-file-sharing-password-entry"), "notify::text", G_CALLBACK (file_sharing_password_changed), NULL); networks = cc_sharing_networks_new (self->priv->sharing_proxy, "gnome-user-share-webdav"); grid = WID ("grid2"); gtk_grid_attach (GTK_GRID (grid), networks, 0, 3, 2, 1); gtk_widget_show (networks); w = cc_sharing_switch_new (networks); gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("personal-file-sharing-headerbar")), w); self->priv->personal_file_sharing_switch = w; cc_sharing_panel_bind_networks_to_label (self, networks, WID ("personal-file-sharing-status-label")); }
static void bind_builder_radio (GtkBuilder *builder, GSettings *settings, const char **widget_names, const char *prefs, const char **values) { GtkWidget *button; int i; for (i = 0; widget_names[i] != NULL; i++) { button = GTK_WIDGET (gtk_builder_get_object (builder, widget_names[i])); g_settings_bind_with_mapping (settings, prefs, button, "active", G_SETTINGS_BIND_DEFAULT, radio_mapping_get, radio_mapping_set, (gpointer) values[i], NULL); } }
static void bind_builder_uint_enum (GtkBuilder *builder, GSettings *settings, const char *widget_name, const char *prefs, const guint64 *values, int n_values) { UIntEnumBinding *binding; binding = g_new (UIntEnumBinding, 1); binding->values = values; binding->n_values = n_values; g_settings_bind_with_mapping (settings, prefs, gtk_builder_get_object (builder, widget_name), "active", G_SETTINGS_BIND_DEFAULT, uint_enum_get_mapping, uint_enum_set_mapping, binding, g_free); }
void keyboard_general_init (CcPanel *panel, GtkBuilder *builder) { if (keyboard_settings == NULL) keyboard_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.keyboard"); if (interface_settings == NULL) interface_settings = g_settings_new ("org.gnome.desktop.interface"); g_settings_bind (keyboard_settings, "repeat", WID ("repeat_toggle"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (keyboard_settings, "repeat", WID ("repeat_table"), "sensitive", G_SETTINGS_BIND_GET); g_settings_bind (keyboard_settings, "delay", gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_delay_scale"))), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind_with_mapping (keyboard_settings, "repeat-interval", gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_speed_scale"))), "value", G_SETTINGS_BIND_DEFAULT, get_rate, set_rate, NULL, NULL); g_settings_bind (interface_settings, "cursor-blink", WID ("cursor_toggle"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (interface_settings, "cursor-blink", WID ("cursor_table"), "sensitive", G_SETTINGS_BIND_GET); g_settings_bind (interface_settings, "cursor-blink-time", gtk_range_get_adjustment (GTK_RANGE (WID ("cursor_blink_time_scale"))), "value", G_SETTINGS_BIND_DEFAULT); g_signal_connect (WID ("linkbutton"), "activate-link", G_CALLBACK (layout_link_clicked), panel); }
static void bind_settings_and_actions (GSettings *settings, GtkActionGroup *action_group, const BindAction *actions, int actions_n) { int i; for (i = 0; i < actions_n; i++) { GtkAction *action; action = gtk_action_group_get_action (action_group, actions[i].action); if (g_strcmp0 (actions[i].prop, "visible") == 0) { g_settings_bind (settings, actions[i].key, action, actions[i].prop, G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN); } else { /* We need a custom get_mapping for 'sensitive' * properties, see usage of * ephy_action_change_sensitivity_flags in * ephy-window.c. */ g_settings_bind_with_mapping (settings, actions[i].key, action, actions[i].prop, G_SETTINGS_BIND_GET, sensitive_get_mapping, NULL, action, NULL); } } }
static GObject * eom_preferences_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { EomPreferencesDialogPrivate *priv; GtkWidget *dlg; GtkWidget *interpolate_check; GtkWidget *extrapolate_check; GtkWidget *autorotate_check; GtkWidget *bg_color_check; GtkWidget *bg_color_button; GtkWidget *color_radio; GtkWidget *checkpattern_radio; GtkWidget *background_radio; GtkWidget *color_button; GtkWidget *upscale_check; GtkWidget *random_check; GtkWidget *loop_check; GtkWidget *seconds_spin; GtkWidget *plugin_manager; GtkWidget *plugin_manager_container; GObject *object; object = G_OBJECT_CLASS (eom_preferences_dialog_parent_class)->constructor (type, n_construct_properties, construct_params); priv = EOM_PREFERENCES_DIALOG (object)->priv; priv->view_settings = g_settings_new (EOM_CONF_VIEW); priv->fullscreen_settings = g_settings_new (EOM_CONF_FULLSCREEN); eom_dialog_construct (EOM_DIALOG (object), "eom-preferences-dialog.ui", "eom_preferences_dialog"); eom_dialog_get_controls (EOM_DIALOG (object), "eom_preferences_dialog", &dlg, "interpolate_check", &interpolate_check, "extrapolate_check", &extrapolate_check, "autorotate_check", &autorotate_check, "bg_color_check", &bg_color_check, "bg_color_button", &bg_color_button, "color_radio", &color_radio, "checkpattern_radio", &checkpattern_radio, "background_radio", &background_radio, "color_button", &color_button, "upscale_check", &upscale_check, "random_check", &random_check, "loop_check", &loop_check, "seconds_spin", &seconds_spin, "plugin_manager_container", &plugin_manager_container, NULL); g_signal_connect (G_OBJECT (dlg), "response", G_CALLBACK (eom_preferences_response_cb), dlg); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_INTERPOLATE, G_OBJECT (interpolate_check), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_EXTRAPOLATE, G_OBJECT (extrapolate_check), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_AUTOROTATE, G_OBJECT (autorotate_check), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (priv->view_settings, EOM_CONF_VIEW_USE_BG_COLOR, G_OBJECT (bg_color_check), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_BACKGROUND_COLOR, bg_color_button, "color", G_SETTINGS_BIND_DEFAULT, pd_string_to_color_mapping, pd_color_to_string_mapping, NULL, NULL); g_object_set_data (G_OBJECT (color_radio), GSETTINGS_OBJECT_VALUE, GINT_TO_POINTER (EOM_TRANSP_COLOR)); g_signal_connect (G_OBJECT (color_radio), "toggled", G_CALLBACK (pd_transp_radio_toggle_cb), priv->view_settings); g_object_set_data (G_OBJECT (checkpattern_radio), GSETTINGS_OBJECT_VALUE, GINT_TO_POINTER (EOM_TRANSP_CHECKED)); g_signal_connect (G_OBJECT (checkpattern_radio), "toggled", G_CALLBACK (pd_transp_radio_toggle_cb), priv->view_settings); g_object_set_data (G_OBJECT (background_radio), GSETTINGS_OBJECT_VALUE, GINT_TO_POINTER (EOM_TRANSP_BACKGROUND)); g_signal_connect (G_OBJECT (background_radio), "toggled", G_CALLBACK (pd_transp_radio_toggle_cb), priv->view_settings); switch (g_settings_get_enum (priv->view_settings, EOM_CONF_VIEW_TRANSPARENCY)) { case EOM_TRANSP_COLOR: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (color_radio), TRUE); break; case EOM_TRANSP_CHECKED: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkpattern_radio), TRUE); break; default: // Log a warning and use EOM_TRANSP_BACKGROUND as fallback g_warn_if_reached (); case EOM_TRANSP_BACKGROUND: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (background_radio), TRUE); break; } g_settings_bind_with_mapping (priv->view_settings, EOM_CONF_VIEW_TRANS_COLOR, color_button, "color", G_SETTINGS_BIND_DEFAULT, pd_string_to_color_mapping, pd_color_to_string_mapping, NULL, NULL); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_UPSCALE, upscale_check, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_LOOP, G_OBJECT (loop_check), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_RANDOM, G_OBJECT (random_check), "active", G_SETTINGS_BIND_DEFAULT); g_signal_connect (priv->fullscreen_settings, "changed::" EOM_CONF_FULLSCREEN_RANDOM, G_CALLBACK (random_change_cb), loop_check); random_change_cb (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_RANDOM, loop_check); g_settings_bind (priv->fullscreen_settings, EOM_CONF_FULLSCREEN_SECONDS, G_OBJECT (seconds_spin), "value", G_SETTINGS_BIND_DEFAULT); plugin_manager = peas_gtk_plugin_manager_new (NULL); g_assert (plugin_manager != NULL); gtk_box_pack_start (GTK_BOX (plugin_manager_container), plugin_manager, TRUE, TRUE, 0); gtk_widget_show_all (plugin_manager); return object; }
/* Set up the property editors in the dialog. */ static void setup_dialog (CcMousePropertiesPrivate *d) { GtkWidget *button; d->left_handed = g_settings_get_boolean (d->mouse_settings, "left-handed"); button = WID (d->left_handed ? "primary-button-right" : "primary-button-left"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE); g_settings_bind (d->mouse_settings, "left-handed", WID ("primary-button-left"), "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN); g_settings_bind (d->mouse_settings, "left-handed", WID ("primary-button-right"), "active", G_SETTINGS_BIND_DEFAULT); /* Allow changing orientation with either button */ button = WID ("primary-button-right"); d->right_gesture = gtk_gesture_multi_press_new (button); handle_secondary_button (d, button, d->right_gesture); button = WID ("primary-button-left"); d->left_gesture = gtk_gesture_multi_press_new (button); handle_secondary_button (d, button, d->left_gesture); g_settings_bind (d->mouse_settings, "natural-scroll", WID ("mouse-natural-scrolling-switch"), "active", G_SETTINGS_BIND_DEFAULT); gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("general-listbox")), cc_list_box_update_header_func, NULL, NULL); gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-listbox")), cc_list_box_update_header_func, NULL, NULL); /* Mouse section */ gtk_widget_set_visible (WID ("mouse-frame"), d->have_mouse); g_settings_bind (d->mouse_settings, "speed", gtk_range_get_adjustment (GTK_RANGE (WID ("mouse-speed-scale"))), "value", G_SETTINGS_BIND_DEFAULT); gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("mouse-listbox")), cc_list_box_update_header_func, NULL, NULL); /* Touchpad section */ gtk_widget_set_visible (WID ("touchpad-toggle-switch"), show_touchpad_enabling_switch (d)); g_settings_bind_with_mapping (d->touchpad_settings, "send-events", WID ("touchpad-toggle-switch"), "active", G_SETTINGS_BIND_DEFAULT, touchpad_enabled_get_mapping, touchpad_enabled_set_mapping, NULL, NULL); g_settings_bind_with_mapping (d->touchpad_settings, "send-events", WID ("touchpad-options-listbox"), "sensitive", G_SETTINGS_BIND_GET, touchpad_enabled_get_mapping, touchpad_enabled_set_mapping, NULL, NULL); g_settings_bind (d->touchpad_settings, "natural-scroll", WID ("touchpad-natural-scrolling-switch"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (d->touchpad_settings, "speed", gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad-speed-scale"))), "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind (d->touchpad_settings, "tap-to-click", WID ("tap-to-click-switch"), "active", G_SETTINGS_BIND_DEFAULT); setup_touchpad_options (d); g_signal_connect (WID ("edge-scrolling-switch"), "state-set", G_CALLBACK (edge_scrolling_changed_event), d); g_signal_connect (WID ("two-finger-scrolling-switch"), "state-set", G_CALLBACK (two_finger_scrolling_changed_event), d); gtk_list_box_set_header_func (GTK_LIST_BOX (WID ("touchpad-options-listbox")), cc_list_box_update_header_func, NULL, NULL); }
static void search_panel_add_one_app_info (CcSearchPanel *self, GAppInfo *app_info, gboolean default_enabled) { GtkWidget *row, *box, *w; GIcon *icon; /* gnome-control-center is special cased in the shell, and is not configurable */ if (g_strcmp0 (g_app_info_get_id (app_info), "gnome-control-center.desktop") == 0) return; /* reset valignment of the list box */ gtk_widget_set_valign (self->priv->list_box, GTK_ALIGN_FILL); row = gtk_list_box_row_new (); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (row), box); gtk_widget_set_hexpand (box, TRUE); gtk_container_set_border_width (GTK_CONTAINER (box), 6); g_object_set_data_full (G_OBJECT (row), "app-info", g_object_ref (app_info), g_object_unref); g_object_set_data (G_OBJECT (row), "self", self); gtk_container_add (GTK_CONTAINER (self->priv->list_box), row); icon = g_app_info_get_icon (app_info); if (icon == NULL) icon = g_themed_icon_new ("application-x-executable"); else g_object_ref (icon); w = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); gtk_container_add (GTK_CONTAINER (box), w); g_object_unref (icon); w = gtk_label_new (g_app_info_get_name (app_info)); gtk_container_add (GTK_CONTAINER (box), w); w = gtk_switch_new (); gtk_widget_set_valign (w, GTK_ALIGN_CENTER); gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0); if (default_enabled) { g_settings_bind_with_mapping (self->priv->search_settings, "disabled", w, "active", G_SETTINGS_BIND_DEFAULT, switch_settings_mapping_get_default_enabled, switch_settings_mapping_set_default_enabled, row, NULL); } else { g_settings_bind_with_mapping (self->priv->search_settings, "enabled", w, "active", G_SETTINGS_BIND_DEFAULT, switch_settings_mapping_get_default_disabled, switch_settings_mapping_set_default_disabled, row, NULL); } gtk_widget_show_all (row); }
void ui_init (AppearanceData *data) { GtkWidget* widget; #if GTK_CHECK_VERSION (3, 10, 0) GtkWidget* container = appearance_capplet_get_widget(data, "vbox24"); // Remove menu accels and toolbar style toggles for new GTK versions gtk_container_remove((GtkContainer *) container, appearance_capplet_get_widget(data, "menu_accel_toggle")); gtk_container_remove((GtkContainer *) container, appearance_capplet_get_widget(data, "hbox11")); #endif widget = appearance_capplet_get_widget(data, "menu_icons_toggle"); g_settings_bind (data->interface_settings, MENU_ICONS_KEY, G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); g_signal_connect (data->interface_settings, "changed::" MENU_ICONS_KEY, G_CALLBACK (menus_have_icons_cb), data); set_have_icons (data, g_settings_get_boolean (data->interface_settings, MENU_ICONS_KEY)); #if !GTK_CHECK_VERSION (3, 10, 0) widget = appearance_capplet_get_widget(data, "menu_accel_toggle"); g_settings_bind (data->interface_settings, ACCEL_CHANGE_KEY, G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT); widget = appearance_capplet_get_widget(data, "toolbar_style_select"); g_settings_bind_with_mapping (data->interface_settings, TOOLBAR_STYLE_KEY, G_OBJECT (widget), "active", G_SETTINGS_BIND_DEFAULT, toolbar_to_widget, toolbar_from_widget, data, NULL); g_signal_connect (data->interface_settings, "changed::" TOOLBAR_STYLE_KEY, (GCallback) toolbar_style_cb, data); char* toolbar_style; toolbar_style = g_settings_get_string (data->interface_settings, TOOLBAR_STYLE_KEY); set_toolbar_style (data, toolbar_style); g_free (toolbar_style); #endif g_signal_connect (appearance_capplet_get_widget (data, "toolbar_handlebox"), "button_press_event", (GCallback) button_press_block_cb, NULL); show_handlebar (data, g_settings_get_boolean (data->interface_settings, TOOLBAR_DETACHABLE_KEY)); /* no ui for detachable toolbars */ g_signal_connect (data->interface_settings, "changed::" TOOLBAR_DETACHABLE_KEY, (GCallback) toolbar_detachable_cb, data); }
void totem_setup_preferences (Totem *totem) { GtkWidget *bvw; guint i, hidden; char *font, *encoding; GObject *item; GtkWidget *content_area; static struct { const char *name; BvwVideoProperty prop; const char *label; const gchar *key; const gchar *adjustment; } props[4] = { { "tpw_contrast_scale", BVW_VIDEO_CONTRAST, "tpw_contrast_label", "contrast", "tpw_contrast_adjustment" }, { "tpw_saturation_scale", BVW_VIDEO_SATURATION, "tpw_saturation_label", "saturation", "tpw_saturation_adjustment" }, { "tpw_bright_scale", BVW_VIDEO_BRIGHTNESS, "tpw_brightness_label", "brightness", "tpw_bright_adjustment" }, { "tpw_hue_scale", BVW_VIDEO_HUE, "tpw_hue_label", "hue", "tpw_hue_adjustment" } }; g_return_if_fail (totem->settings != NULL); g_return_if_fail (totem->prefs != NULL); content_area = POBJ ("tpw_dialog_vbox"); g_return_if_fail (content_area != NULL); gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (totem->prefs))), content_area); bvw = totem_object_get_video_widget (totem); g_signal_connect (G_OBJECT (totem->prefs), "response", G_CALLBACK (gtk_widget_hide), NULL); g_signal_connect (G_OBJECT (totem->prefs), "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); g_signal_connect (totem->prefs, "destroy", G_CALLBACK (gtk_widget_destroyed), &totem->prefs); /* Disable deinterlacing */ item = POBJ ("tpw_no_deinterlace_checkbutton"); g_settings_bind (totem->settings, "disable-deinterlacing", item, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, "disable-deinterlacing", bvw, "deinterlacing", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY | G_SETTINGS_BIND_INVERT_BOOLEAN); /* Auto-load subtitles */ item = POBJ ("tpw_auto_subtitles_checkbutton"); g_settings_bind (totem->settings, "autoload-subtitles", item, "active", G_SETTINGS_BIND_DEFAULT); /* Auto-load external chapters */ item = POBJ ("tpw_auto_chapters_checkbutton"); g_settings_bind (totem->settings, "autoload-chapters", item, "active", G_SETTINGS_BIND_DEFAULT); /* Plugins button */ item = POBJ ("tpw_plugins_button"); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (plugin_button_clicked_cb), totem); /* Brightness and all */ hidden = 0; for (i = 0; i < G_N_ELEMENTS (props); i++) { int prop_value; item = POBJ (props[i].adjustment); g_settings_bind (totem->settings, props[i].key, item, "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, props[i].key, bvw, props[i].key, G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); prop_value = bacon_video_widget_get_video_property (totem->bvw, props[i].prop); if (prop_value < 0) { /* The property's unsupported, so hide the widget and its label */ item = POBJ (props[i].name); gtk_range_set_value (GTK_RANGE (item), (gdouble) 65535/2); gtk_widget_hide (GTK_WIDGET (item)); item = POBJ (props[i].label); gtk_widget_hide (GTK_WIDGET (item)); hidden++; } } /* If all the properties have been hidden, hide their section box */ if (hidden == G_N_ELEMENTS (props)) { item = POBJ ("tpw_bright_contr_vbox"); gtk_widget_hide (GTK_WIDGET (item)); } /* Sound output type */ item = POBJ ("tpw_sound_output_combobox"); g_settings_bind (totem->settings, "audio-output-type", bvw, "audio-output-type", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_with_mapping (totem->settings, "audio-output-type", item, "active", G_SETTINGS_BIND_DEFAULT, (GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping, g_type_class_ref (BVW_TYPE_AUDIO_OUTPUT_TYPE), (GDestroyNotify) g_type_class_unref); /* Subtitle font selection */ item = POBJ ("font_sel_button"); gtk_font_button_set_title (GTK_FONT_BUTTON (item), _("Select Subtitle Font")); font = g_settings_get_string (totem->settings, "subtitle-font"); if (*font != '\0') { gtk_font_button_set_font_name (GTK_FONT_BUTTON (item), font); bacon_video_widget_set_subtitle_font (totem->bvw, font); } g_free (font); g_signal_connect (totem->settings, "changed::subtitle-font", (GCallback) font_changed_cb, totem); /* Subtitle encoding selection */ item = POBJ ("subtitle_encoding_combo"); totem_subtitle_encoding_init (GTK_COMBO_BOX (item)); encoding = g_settings_get_string (totem->settings, "subtitle-encoding"); /* Make sure the default is UTF-8 */ if (*encoding == '\0') { g_free (encoding); encoding = g_strdup ("UTF-8"); } totem_subtitle_encoding_set (GTK_COMBO_BOX(item), encoding); if (encoding && strcasecmp (encoding, "") != 0) { bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding); } g_free (encoding); g_signal_connect (totem->settings, "changed::subtitle-encoding", (GCallback) encoding_changed_cb, totem); /* Disable keyboard shortcuts */ totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts"); g_signal_connect (totem->settings, "changed::disable-keyboard-shortcuts", (GCallback) disable_kbd_shortcuts_changed_cb, totem); g_object_unref (bvw); }
static void cc_sharing_panel_setup_screen_sharing_dialog (CcSharingPanel *self) { CcSharingPanelPrivate *priv = self->priv; GSettings *settings; GtkWidget *networks, *box, *w; cc_sharing_panel_bind_switch_to_widgets (WID ("require-password-radiobutton"), WID ("password-grid"), NULL); cc_sharing_panel_setup_label_with_hostname (self, WID ("screen-sharing-label")); /* settings bindings */ settings = g_settings_new (VINO_SCHEMA_ID); g_settings_bind (settings, "view-only", WID ("remote-control-switch"), "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN); g_settings_bind (settings, "prompt-enabled", WID ("approve-connections-radiobutton"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind_with_mapping (settings, "authentication-methods", WID ("require-password-radiobutton"), "active", G_SETTINGS_BIND_DEFAULT, vino_get_authtype, vino_set_authtype, NULL, NULL); g_settings_bind_with_mapping (settings, "vnc-password", WID ("remote-control-password-entry"), "text", G_SETTINGS_BIND_DEFAULT, vino_get_password, vino_set_password, NULL, NULL); g_object_bind_property (WID ("show-password-checkbutton"), "active", WID ("remote-control-password-entry"), "visibility", G_BINDING_SYNC_CREATE); /* make sure the password entry is hidden by default */ g_signal_connect (priv->screen_sharing_dialog, "show", G_CALLBACK (screen_sharing_show_cb), self); g_signal_connect (priv->screen_sharing_dialog, "hide", G_CALLBACK (screen_sharing_hide_cb), self); /* accept at most 8 bytes in password entry */ g_signal_connect (WID ("remote-control-password-entry"), "insert-text", G_CALLBACK (screen_sharing_password_insert_text_cb), self); networks = cc_sharing_networks_new (self->priv->sharing_proxy, "vino-server"); box = WID ("remote-control-box"); gtk_box_pack_end (GTK_BOX (box), networks, TRUE, TRUE, 0); gtk_widget_show (networks); w = cc_sharing_switch_new (networks); gtk_header_bar_pack_start (GTK_HEADER_BAR (WID ("screen-sharing-headerbar")), w); self->priv->screen_sharing_switch = w; cc_sharing_panel_bind_networks_to_label (self, networks, WID ("screen-sharing-status-label")); }
void totem_setup_preferences (Totem *totem) { GtkWidget *menu, *content_area, *bvw; gboolean show_visuals, lock_screensaver_on_audio; guint i, hidden; char *visual, *font, *encoding; GList *list, *l; GtkWidget *widget; GObject *item; static struct { const char *name; BvwVideoProperty prop; const char *label; const gchar *key; const gchar *adjustment; } props[4] = { { "tpw_contrast_scale", BVW_VIDEO_CONTRAST, "tpw_contrast_label", "contrast", "tpw_contrast_adjustment" }, { "tpw_saturation_scale", BVW_VIDEO_SATURATION, "tpw_saturation_label", "saturation", "tpw_saturation_adjustment" }, { "tpw_bright_scale", BVW_VIDEO_BRIGHTNESS, "tpw_brightness_label", "brightness", "tpw_bright_adjustment" }, { "tpw_hue_scale", BVW_VIDEO_HUE, "tpw_hue_label", "hue", "tpw_hue_adjustment" } }; g_return_if_fail (totem->settings != NULL); bvw = totem_get_video_widget (totem); /* Work-around builder dialogue not parenting properly for * On top windows */ widget = PWID ("tpw_notebook"); totem->prefs = gtk_dialog_new_with_buttons (_("Preferences"), GTK_WINDOW (totem->win), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, NULL); gtk_container_set_border_width (GTK_CONTAINER (totem->prefs), 5); content_area = gtk_dialog_get_content_area (GTK_DIALOG (totem->prefs)); gtk_box_set_spacing (GTK_BOX (content_area), 2); gtk_widget_reparent (widget, content_area); gtk_widget_show_all (content_area); widget = PWID ("totem_preferences_window"); gtk_widget_destroy (widget); g_signal_connect (G_OBJECT (totem->prefs), "response", G_CALLBACK (gtk_widget_hide), NULL); g_signal_connect (G_OBJECT (totem->prefs), "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL); g_signal_connect (totem->prefs, "destroy", G_CALLBACK (gtk_widget_destroyed), &totem->prefs); /* Remember position */ item = POBJ ("tpw_remember_position_checkbutton"); g_settings_bind (totem->settings, "remember-position", item, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, "remember-position", totem, "remember-position", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); /* Auto-resize */ item = POBJ ("tpw_display_checkbutton"); g_settings_bind (totem->settings, "auto-resize", item, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, "auto-resize", bvw, "auto-resize", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); /* Screensaver audio locking */ lock_screensaver_on_audio = g_settings_get_boolean (totem->settings, "lock-screensaver-on-audio"); if (lock_screensaver_on_audio != FALSE) item = POBJ ("tpw_audio_toggle_button"); else item = POBJ ("tpw_video_toggle_button"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), TRUE); g_signal_connect (totem->settings, "changed::lock-screensaver-on-audio", (GCallback) lock_screensaver_on_audio_changed_cb, totem); /* Disable deinterlacing */ item = POBJ ("tpw_no_deinterlace_checkbutton"); g_settings_bind (totem->settings, "disable-deinterlacing", item, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, "disable-deinterlacing", bvw, "deinterlacing", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY | G_SETTINGS_BIND_INVERT_BOOLEAN); /* Enable visuals */ item = POBJ ("tpw_visuals_checkbutton"); show_visuals = g_settings_get_boolean (totem->settings, "show-visualizations"); g_signal_handlers_disconnect_by_func (item, checkbutton2_toggled_cb, totem); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), show_visuals); totem_prefs_set_show_visuals (totem, show_visuals); g_signal_connect (item, "toggled", G_CALLBACK (checkbutton2_toggled_cb), totem); g_signal_connect (totem->settings, "changed::show-visualizations", (GCallback) show_vfx_changed_cb, totem); /* Auto-load subtitles */ item = POBJ ("tpw_auto_subtitles_checkbutton"); g_settings_bind (totem->settings, "autoload-subtitles", item, "active", G_SETTINGS_BIND_DEFAULT); /* Auto-load external chapters */ item = POBJ ("tpw_auto_chapters_checkbutton"); g_settings_bind (totem->settings, "autoload-chapters", item, "active", G_SETTINGS_BIND_DEFAULT); /* Visuals list */ list = bacon_video_widget_get_visualization_list (totem->bvw); menu = gtk_menu_new (); gtk_widget_show (menu); visual = g_settings_get_string (totem->settings, "visualization-name"); if (*visual == '\0') { g_free (visual); visual = g_strdup ("goom"); } item = POBJ ("tpw_visuals_type_liststore"); i = 0; for (l = list; l != NULL; l = l->next) { const char *name = l->data; GtkTreeIter iter; gtk_list_store_append (GTK_LIST_STORE (item), &iter); gtk_list_store_set (GTK_LIST_STORE (item), &iter, 0, name, -1); if (strcmp (name, visual) == 0) { GObject *combobox; combobox = POBJ ("tpw_visuals_type_combobox"); gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), i); } i++; } g_free (visual); /* Visualisation quality. We have to bind the writability separately, as the sensitivity of the size combobox is also affected by whether * visualizations are enabled. */ item = POBJ ("tpw_visuals_size_combobox"); g_settings_bind (totem->settings, "visualization-quality", bvw, "visualization-quality", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_with_mapping (totem->settings, "visualization-quality", item, "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY, (GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping, g_type_class_ref (BVW_TYPE_VISUALIZATION_QUALITY), (GDestroyNotify) g_type_class_unref); g_signal_connect (totem->settings, "writable-changed::visualization-quality", (GCallback) visualization_quality_writable_changed_cb, totem); /* Brightness and all */ hidden = 0; for (i = 0; i < G_N_ELEMENTS (props); i++) { int prop_value; item = POBJ (props[i].adjustment); g_settings_bind (totem->settings, props[i].key, item, "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind (totem->settings, props[i].key, bvw, props[i].key, G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); prop_value = bacon_video_widget_get_video_property (totem->bvw, props[i].prop); if (prop_value < 0) { /* The property's unsupported, so hide the widget and its label */ item = POBJ (props[i].name); gtk_range_set_value (GTK_RANGE (item), (gdouble) 65535/2); gtk_widget_hide (GTK_WIDGET (item)); item = POBJ (props[i].label); gtk_widget_hide (GTK_WIDGET (item)); hidden++; } } /* If all the properties have been hidden, hide their section box */ if (hidden == G_N_ELEMENTS (props)) { item = POBJ ("tpw_bright_contr_vbox"); gtk_widget_hide (GTK_WIDGET (item)); } /* Sound output type */ item = POBJ ("tpw_sound_output_combobox"); g_settings_bind (totem->settings, "audio-output-type", bvw, "audio-output-type", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_with_mapping (totem->settings, "audio-output-type", item, "active", G_SETTINGS_BIND_DEFAULT, (GSettingsBindGetMapping) int_enum_get_mapping, (GSettingsBindSetMapping) int_enum_set_mapping, g_type_class_ref (BVW_TYPE_AUDIO_OUTPUT_TYPE), (GDestroyNotify) g_type_class_unref); /* Subtitle font selection */ item = POBJ ("font_sel_button"); gtk_font_button_set_title (GTK_FONT_BUTTON (item), _("Select Subtitle Font")); font = g_settings_get_string (totem->settings, "subtitle-font"); if (*font != '\0') { gtk_font_button_set_font_name (GTK_FONT_BUTTON (item), font); bacon_video_widget_set_subtitle_font (totem->bvw, font); } g_free (font); g_signal_connect (totem->settings, "changed::subtitle-font", (GCallback) font_changed_cb, totem); /* Subtitle encoding selection */ item = POBJ ("subtitle_encoding_combo"); totem_subtitle_encoding_init (GTK_COMBO_BOX (item)); encoding = g_settings_get_string (totem->settings, "subtitle-encoding"); /* Make sure the default is UTF-8 */ if (*encoding == '\0') { g_free (encoding); encoding = g_strdup ("UTF-8"); } totem_subtitle_encoding_set (GTK_COMBO_BOX(item), encoding); if (encoding && strcasecmp (encoding, "") != 0) { bacon_video_widget_set_subtitle_encoding (totem->bvw, encoding); } g_free (encoding); g_signal_connect (totem->settings, "changed::subtitle-encoding", (GCallback) encoding_changed_cb, totem); /* Disable keyboard shortcuts */ totem->disable_kbd_shortcuts = g_settings_get_boolean (totem->settings, "disable-keyboard-shortcuts"); g_signal_connect (totem->settings, "changed::disable-keyboard-shortcuts", (GCallback) disable_kbd_shortcuts_changed_cb, totem); g_object_unref (bvw); }
static void current_call_view_init(CurrentCallView *view) { gtk_widget_init_template(GTK_WIDGET(view)); CurrentCallViewPrivate *priv = CURRENT_CALL_VIEW_GET_PRIVATE(view); /* create video widget and overlay the call info and controls on it */ priv->video_widget = video_widget_new(); gtk_container_add(GTK_CONTAINER(priv->frame_video), priv->video_widget); gtk_widget_show_all(priv->frame_video); auto stage = gtk_clutter_embed_get_stage(GTK_CLUTTER_EMBED(priv->video_widget)); auto actor_info = gtk_clutter_actor_new_with_contents(priv->hbox_call_info); auto actor_controls = gtk_clutter_actor_new_with_contents(priv->hbox_call_controls); clutter_actor_add_child(stage, actor_info); clutter_actor_set_x_align(actor_info, CLUTTER_ACTOR_ALIGN_FILL); clutter_actor_set_y_align(actor_info, CLUTTER_ACTOR_ALIGN_START); clutter_actor_add_child(stage, actor_controls); clutter_actor_set_x_align(actor_controls, CLUTTER_ACTOR_ALIGN_CENTER); clutter_actor_set_y_align(actor_controls, CLUTTER_ACTOR_ALIGN_END); /* add fade in and out states to the info and controls */ priv->time_last_mouse_motion = g_get_monotonic_time(); priv->fade_info = create_fade_out_transition(); priv->fade_controls = create_fade_out_transition(); clutter_actor_add_transition(actor_info, "fade_info", priv->fade_info); clutter_actor_add_transition(actor_controls, "fade_controls", priv->fade_controls); clutter_timeline_set_direction(CLUTTER_TIMELINE(priv->fade_info), CLUTTER_TIMELINE_BACKWARD); clutter_timeline_set_direction(CLUTTER_TIMELINE(priv->fade_controls), CLUTTER_TIMELINE_BACKWARD); clutter_timeline_stop(CLUTTER_TIMELINE(priv->fade_info)); clutter_timeline_stop(CLUTTER_TIMELINE(priv->fade_controls)); /* have a timer check every 1 second if the controls should fade out */ priv->timer_fade = g_timeout_add(1000, (GSourceFunc)timeout_check_last_motion_event, view); /* connect to the mouse motion event to reset the last moved time */ g_signal_connect_swapped(priv->video_widget, "motion-notify-event", G_CALLBACK(mouse_moved), view); g_signal_connect_swapped(priv->video_widget, "button-press-event", G_CALLBACK(mouse_moved), view); g_signal_connect_swapped(priv->video_widget, "button-release-event", G_CALLBACK(mouse_moved), view); /* manually handle the focus of the video widget to be able to focus on the call controls */ g_signal_connect(priv->video_widget, "focus", G_CALLBACK(video_widget_focus), view); /* toggle whether or not the chat is displayed */ g_signal_connect(priv->togglebutton_chat, "toggled", G_CALLBACK(chat_toggled), view); /* bind the chat orientation to the gsetting */ priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL); g_settings_bind_with_mapping(priv->settings, "chat-pane-horizontal", priv->paned_call, "orientation", G_SETTINGS_BIND_GET, map_boolean_to_orientation, nullptr, nullptr, nullptr); g_signal_connect(priv->scalebutton_quality, "value-changed", G_CALLBACK(quality_changed), view); /* customize the quality button scale */ if (auto scale_box = gtk_scale_button_get_box(GTK_SCALE_BUTTON(priv->scalebutton_quality))) { priv->checkbutton_autoquality = gtk_check_button_new_with_label(C_("Enable automatic video quality", "Auto")); gtk_widget_show(priv->checkbutton_autoquality); gtk_box_pack_start(GTK_BOX(scale_box), priv->checkbutton_autoquality, FALSE, TRUE, 0); g_signal_connect(priv->checkbutton_autoquality, "toggled", G_CALLBACK(autoquality_toggled), view); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_autoquality), TRUE); } if (auto scale = gtk_scale_button_get_scale(GTK_SCALE_BUTTON(priv->scalebutton_quality))) { g_signal_connect(scale, "button-press-event", G_CALLBACK(quality_button_pressed), view); g_signal_connect(scale, "button-release-event", G_CALLBACK(quality_button_released), view); } }
static void create_playlist_dialog (EtPlaylistDialog *self) { EtPlaylistDialogPrivate *priv; priv = et_playlist_dialog_get_instance_private (self); /* Playlist name */ g_settings_bind (MainSettings, "playlist-filename-mask", priv->name_mask_entry, "text", G_SETTINGS_BIND_DEFAULT); g_settings_bind (MainSettings, "playlist-use-mask", priv->name_mask_radio, "active", G_SETTINGS_BIND_DEFAULT); /* Playlist options */ g_settings_bind (MainSettings, "playlist-selected-only", priv->selected_files_check, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (MainSettings, "playlist-relative", priv->path_relative_radio, "active", G_SETTINGS_BIND_DEFAULT); /* Create playlist in parent directory. */ g_settings_bind (MainSettings, "playlist-parent-directory", priv->playlist_parent_check, "active", G_SETTINGS_BIND_DEFAULT); /* DOS Separator. */ g_settings_bind (MainSettings, "playlist-dos-separator", priv->playlist_dos_check, "active", G_SETTINGS_BIND_DEFAULT); /* Playlist content */ g_settings_bind (MainSettings, "playlist-default-mask", priv->content_mask_entry, "text", G_SETTINGS_BIND_DEFAULT); /* Mask status icon. Signal connection to check if mask is correct in the * mask entry. */ g_signal_connect (priv->content_mask_entry, "changed", G_CALLBACK (entry_check_content_mask), NULL); g_settings_bind_with_mapping (MainSettings, "playlist-content", priv->content_filenames_radio, "active", G_SETTINGS_BIND_DEFAULT, et_settings_enum_radio_get, et_settings_enum_radio_set, priv->content_filenames_radio, NULL); g_settings_bind_with_mapping (MainSettings, "playlist-content", priv->content_extended_radio, "active", G_SETTINGS_BIND_DEFAULT, et_settings_enum_radio_get, et_settings_enum_radio_set, priv->content_extended_radio, NULL); g_settings_bind_with_mapping (MainSettings, "playlist-content", priv->content_extended_mask_radio, "active", G_SETTINGS_BIND_DEFAULT, et_settings_enum_radio_get, et_settings_enum_radio_set, priv->content_extended_mask_radio, NULL); /* To initialize the mask status icon and visibility. */ g_signal_emit_by_name (priv->name_mask_entry, "changed"); g_signal_emit_by_name (priv->content_mask_entry, "changed"); }
static void nemo_window_pane_constructed (GObject *obj) { NemoWindowPane *pane = NEMO_WINDOW_PANE (obj); GtkSizeGroup *header_size_group; NemoWindow *window; GtkActionGroup *action_group; G_OBJECT_CLASS (nemo_window_pane_parent_class)->constructed (obj); window = pane->window; header_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); gtk_size_group_set_ignore_hidden (header_size_group, FALSE); /* build the toolbar */ action_group = nemo_window_create_toolbar_action_group (window); pane->toolbar_action_group = action_group; pane->tool_bar = GTK_WIDGET (nemo_toolbar_new (action_group)); g_signal_connect_object (pane->tool_bar, "notify::show-location-entry", G_CALLBACK (location_entry_changed_cb), pane, 0); pane->action_group = action_group; setup_search_action (pane); g_signal_connect (pane->action_group, "pre-activate", G_CALLBACK (toolbar_action_group_activated_callback), pane); /* Pack to windows hbox (under the menu */ gtk_box_pack_start (GTK_BOX (window->details->toolbar_holder), pane->tool_bar, TRUE, TRUE, 0); /* start as non-active */ nemo_window_pane_set_active (pane, FALSE); g_settings_bind_with_mapping (nemo_window_state, NEMO_WINDOW_STATE_START_WITH_TOOLBAR, pane->tool_bar, "visible", G_SETTINGS_BIND_GET, nemo_window_disable_chrome_mapping, NULL, window, NULL); /* connect to the pathbar signals */ pane->path_bar = nemo_toolbar_get_path_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->path_bar); g_signal_connect_object (pane->path_bar, "path-clicked", G_CALLBACK (path_bar_location_changed_callback), pane, 0); g_signal_connect_object (pane->path_bar, "path-set", G_CALLBACK (path_bar_path_set_callback), pane, 0); /* connect to the location bar signals */ pane->location_bar = nemo_toolbar_get_location_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->location_bar); nemo_clipboard_set_up_editable (GTK_EDITABLE (nemo_location_bar_get_entry (NEMO_LOCATION_BAR (pane->location_bar))), nemo_window_get_ui_manager (NEMO_WINDOW (window)), TRUE); g_signal_connect_object (pane->location_bar, "location-changed", G_CALLBACK (navigation_bar_location_changed_callback), pane, 0); g_signal_connect_object (pane->location_bar, "cancel", G_CALLBACK (navigation_bar_cancel_callback), pane, 0); g_signal_connect_object (nemo_location_bar_get_entry (NEMO_LOCATION_BAR (pane->location_bar)), "focus-in-event", G_CALLBACK (toolbar_focus_in_callback), pane, 0); /* connect to the search bar signals */ pane->search_bar = nemo_toolbar_get_search_bar (NEMO_TOOLBAR (pane->tool_bar)); gtk_size_group_add_widget (header_size_group, pane->search_bar); g_signal_connect_object (pane->search_bar, "activate", G_CALLBACK (search_bar_activate_callback), pane, 0); g_signal_connect_object (pane->search_bar, "cancel", G_CALLBACK (search_bar_cancel_callback), pane, 0); g_signal_connect_object (nemo_search_bar_get_entry (NEMO_SEARCH_BAR (pane->search_bar)), "focus-in-event", G_CALLBACK (toolbar_focus_in_callback), pane, 0); /* initialize the notebook */ pane->notebook = g_object_new (NEMO_TYPE_NOTEBOOK, NULL); gtk_box_pack_start (GTK_BOX (pane), pane->notebook, TRUE, TRUE, 0); g_signal_connect (pane->notebook, "tab-close-request", G_CALLBACK (notebook_tab_close_requested), pane); g_signal_connect_after (pane->notebook, "button_press_event", G_CALLBACK (notebook_button_press_cb), pane); g_signal_connect (pane->notebook, "popup-menu", G_CALLBACK (notebook_popup_menu_cb), pane); g_signal_connect (pane->notebook, "switch-page", G_CALLBACK (notebook_switch_page_cb), pane); g_signal_connect (pane->notebook, "create-window", G_CALLBACK (notebook_create_window_cb), pane); g_signal_connect (pane->notebook, "page-added", G_CALLBACK (notebook_page_added_cb), pane); g_signal_connect (pane->notebook, "page-removed", G_CALLBACK (notebook_page_removed_cb), pane); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (pane->notebook), FALSE); gtk_notebook_set_show_border (GTK_NOTEBOOK (pane->notebook), FALSE); gtk_notebook_set_group_name (GTK_NOTEBOOK (pane->notebook), "nemo-slots"); gtk_widget_show (pane->notebook); gtk_container_set_border_width (GTK_CONTAINER (pane->notebook), 0); /* Ensure that the view has some minimal size and that other parts * of the UI (like location bar and tabs) don't request more and * thus affect the default position of the split view paned. */ gtk_widget_set_size_request (GTK_WIDGET (pane), 60, 60); /* * If we're on the desktop we need to make sure the toolbar can never show */ if (NEMO_IS_DESKTOP_WINDOW(window)) { gtk_widget_hide (GTK_WIDGET (window->details->toolbar_holder)); } /* we can unref the size group now */ g_object_unref (header_size_group); }
/* Set up the property editors in the dialog. */ static void setup_dialog (CcMousePropertiesPrivate *d) { GtkRadioButton *radio; /* Orientation radio buttons */ radio = GTK_RADIO_BUTTON (WID ("left_handed_radio")); g_settings_bind (d->mouse_settings, "left-handed", radio, "active", G_SETTINGS_BIND_DEFAULT); /* explicitly connect to button-release so that you can change orientation with either button */ g_signal_connect (WID ("right_handed_radio"), "button_release_event", G_CALLBACK (orientation_radio_button_release_event), NULL); g_signal_connect (WID ("left_handed_radio"), "button_release_event", G_CALLBACK (orientation_radio_button_release_event), NULL); /* Double-click time */ g_settings_bind (d->gsd_mouse_settings, "double-click", gtk_range_get_adjustment (GTK_RANGE (WID ("double_click_scale"))), "value", G_SETTINGS_BIND_DEFAULT); /* Mouse section */ gtk_widget_set_visible (WID ("mouse_vbox"), d->have_mouse); gtk_scale_add_mark (GTK_SCALE (WID ("pointer_speed_scale")), 0, GTK_POS_TOP, NULL); g_settings_bind (d->mouse_settings, "speed", gtk_range_get_adjustment (GTK_RANGE (WID ("pointer_speed_scale"))), "value", G_SETTINGS_BIND_DEFAULT); /* Trackpad page */ gtk_widget_set_visible (WID ("touchpad_vbox"), d->have_touchpad); gtk_widget_set_visible (WID ("touchpad_enabled_switch"), show_touchpad_enabling_switch (d)); g_settings_bind_with_mapping (d->touchpad_settings, "send-events", WID ("touchpad_enabled_switch"), "active", G_SETTINGS_BIND_DEFAULT, touchpad_enabled_get_mapping, touchpad_enabled_set_mapping, NULL, NULL); g_settings_bind_with_mapping (d->touchpad_settings, "send-events", WID ("touchpad_options_box"), "sensitive", G_SETTINGS_BIND_GET, touchpad_enabled_get_mapping, touchpad_enabled_set_mapping, NULL, NULL); g_settings_bind (d->touchpad_settings, "tap-to-click", WID ("tap_to_click_toggle"), "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (d->touchpad_settings, "natural-scroll", WID ("natural_scroll_toggle"), "active", G_SETTINGS_BIND_DEFAULT); gtk_scale_add_mark (GTK_SCALE (WID ("touchpad_pointer_speed_scale")), 0, GTK_POS_TOP, NULL); g_settings_bind (d->touchpad_settings, "speed", gtk_range_get_adjustment (GTK_RANGE (WID ("touchpad_pointer_speed_scale"))), "value", G_SETTINGS_BIND_DEFAULT); if (d->have_touchpad) { synaptics_check_capabilities (d); setup_scrollmethod_radios (d); } g_signal_connect (WID ("two_finger_scroll_toggle"), "toggled", G_CALLBACK (scrollmethod_changed_event), d); }
/** * terminal_profile_edit: * @profile: a #GSettings * @transient_parent: a #GtkWindow, or %NULL * @widget_name: a widget name in the profile editor's UI, or %NULL * * Shows the profile editor with @profile, anchored to @transient_parent. * If @widget_name is non-%NULL, focuses the corresponding widget and * switches the notebook to its containing page. */ void terminal_profile_edit (GSettings *profile, GtkWindow *transient_parent, const char *widget_name) { TerminalSettingsList *profiles_list; GtkBuilder *builder; GError *error = NULL; GtkWidget *editor, *w; gs_free char *uuid = NULL; guint i; gfloat style_darkness; editor = g_object_get_data (G_OBJECT (profile), "editor-window"); if (editor) { terminal_util_dialog_focus_widget (editor, widget_name); gtk_window_set_transient_for (GTK_WINDOW (editor), NULL); gtk_window_present (GTK_WINDOW (editor)); return; } fixup_color_chooser_button (); profiles_list = terminal_app_get_profiles_list (terminal_app_get ()); builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/org/gnome/terminal/ui/profile-preferences.ui", &error); g_assert_no_error (error); editor = (GtkWidget *) gtk_builder_get_object (builder, "profile-editor-dialog"); g_object_set_data_full (G_OBJECT (editor), "builder", builder, (GDestroyNotify) g_object_unref); /* Store the dialogue on the profile, so we can acccess it above to check if * there's already a profile editor for this profile. */ g_object_set_data (G_OBJECT (profile), "editor-window", editor); g_signal_connect (editor, "destroy", G_CALLBACK (profile_editor_destroyed), profile); w = (GtkWidget *) gtk_builder_get_object (builder, "close-button"); g_signal_connect (w, "clicked", G_CALLBACK (editor_close_button_clicked_cb), editor); w = (GtkWidget *) gtk_builder_get_object (builder, "help-button"); g_signal_connect (w, "clicked", G_CALLBACK (editor_help_button_clicked_cb), editor); w = (GtkWidget *) gtk_builder_get_object (builder, "profile-editor-notebook"); gtk_widget_add_events (w, GDK_BUTTON_PRESS_MASK | GDK_SCROLL_MASK); g_signal_connect (w, "scroll-event", G_CALLBACK (scroll_event_cb), NULL); uuid = terminal_settings_list_dup_uuid_from_child (profiles_list, profile); gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (builder, "profile-uuid")), uuid); g_signal_connect (gtk_builder_get_object (builder, "default-size-reset-button"), "clicked", G_CALLBACK (default_size_reset_cb), profile); w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox"); init_color_scheme_menu (w); /* Hook up the palette colorpickers and combo box */ for (i = 0; i < TERMINAL_PALETTE_SIZE; ++i) { char name[32]; char *text; g_snprintf (name, sizeof (name), "palette-colorpicker-%u", i + 1); w = (GtkWidget *) gtk_builder_get_object (builder, name); g_object_set_data (G_OBJECT (w), "palette-entry-index", GUINT_TO_POINTER (i)); text = g_strdup_printf (_("Choose Palette Color %u"), i + 1); gtk_color_button_set_title (GTK_COLOR_BUTTON (w), text); g_free (text); text = g_strdup_printf (_("Palette entry %u"), i + 1); gtk_widget_set_tooltip_text (w, text); g_free (text); g_signal_connect (w, "notify::rgba", G_CALLBACK (palette_color_notify_cb), profile); } gtk_widget_style_get (GTK_WIDGET ( terminal_window_get_active (TERMINAL_WINDOW (transient_parent))), "background-darkness", &style_darkness, NULL); gtk_widget_set_visible (gtk_builder_get_object ( builder, "use-theme-transparency-checkbutton"), style_darkness >= 0); profile_palette_notify_colorpickers_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, editor); g_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY, G_CALLBACK (profile_palette_notify_colorpickers_cb), editor); w = (GtkWidget *) gtk_builder_get_object (builder, "palette-combobox"); g_signal_connect (w, "notify::active", G_CALLBACK (palette_scheme_combo_changed_cb), profile); profile_palette_notify_scheme_combo_cb (profile, TERMINAL_PROFILE_PALETTE_KEY, GTK_COMBO_BOX (w)); g_signal_connect (profile, "changed::" TERMINAL_PROFILE_PALETTE_KEY, G_CALLBACK (profile_palette_notify_scheme_combo_cb), w); /* Hook up the color scheme pickers and combo box */ w = (GtkWidget *) gtk_builder_get_object (builder, "color-scheme-combobox"); g_signal_connect (w, "notify::active", G_CALLBACK (color_scheme_combo_changed_cb), profile); profile_colors_notify_scheme_combo_cb (profile, NULL, GTK_COMBO_BOX (w)); g_signal_connect (profile, "changed::" TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, G_CALLBACK (profile_colors_notify_scheme_combo_cb), w); g_signal_connect (profile, "changed::" TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, G_CALLBACK (profile_colors_notify_scheme_combo_cb), w); w = GTK_WIDGET (gtk_builder_get_object (builder, "custom-command-entry")); custom_command_entry_changed_cb (GTK_ENTRY (w)); g_signal_connect (w, "changed", G_CALLBACK (custom_command_entry_changed_cb), NULL); g_signal_connect (gtk_builder_get_object (builder, "reset-compat-defaults-button"), "clicked", G_CALLBACK (reset_compat_defaults_cb), profile); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, editor, "title", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY, (GSettingsBindGetMapping) string_to_window_title, NULL, NULL, NULL); g_settings_bind (profile, TERMINAL_PROFILE_ALLOW_BOLD_KEY, gtk_builder_get_object (builder, "allow-bold-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_BACKGROUND_COLOR_KEY, gtk_builder_get_object (builder, "background-colorpicker"), "rgba", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) s_to_rgba, (GSettingsBindSetMapping) rgba_to_s, NULL, NULL); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_BACKSPACE_BINDING_KEY, gtk_builder_get_object (builder, "backspace-binding-combobox"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) string_to_enum, (GSettingsBindSetMapping) enum_to_string, vte_erase_binding_get_type, NULL); g_settings_bind (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY, gtk_builder_get_object (builder, "bold-color-same-as-fg-checkbox"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_BOLD_COLOR_SAME_AS_FG_KEY, gtk_builder_get_object (builder, "bold-colorpicker-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_BOLD_COLOR_KEY, gtk_builder_get_object (builder, "bold-colorpicker"), "rgba", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) s_to_rgba, (GSettingsBindSetMapping) rgba_to_s, NULL, NULL); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_CURSOR_SHAPE_KEY, gtk_builder_get_object (builder, "cursor-shape-combobox"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) string_to_enum, (GSettingsBindSetMapping) enum_to_string, vte_cursor_shape_get_type, NULL); g_settings_bind (profile, TERMINAL_PROFILE_CUSTOM_COMMAND_KEY, gtk_builder_get_object (builder, "custom-command-entry"), "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_COLUMNS_KEY, gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "default-size-columns-spinbutton"))), "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_DEFAULT_SIZE_ROWS_KEY, gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "default-size-rows-spinbutton"))), "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_DELETE_BINDING_KEY, gtk_builder_get_object (builder, "delete-binding-combobox"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) string_to_enum, (GSettingsBindSetMapping) enum_to_string, vte_erase_binding_get_type, NULL); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_EXIT_ACTION_KEY, gtk_builder_get_object (builder, "exit-action-combobox"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) string_to_enum, (GSettingsBindSetMapping) enum_to_string, terminal_exit_action_get_type, NULL); g_settings_bind (profile, TERMINAL_PROFILE_FONT_KEY, gtk_builder_get_object (builder, "font-selector"), "font-name", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_FOREGROUND_COLOR_KEY, gtk_builder_get_object (builder, "foreground-colorpicker"), "rgba", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) s_to_rgba, (GSettingsBindSetMapping) rgba_to_s, NULL, NULL); g_settings_bind (profile, TERMINAL_PROFILE_LOGIN_SHELL_KEY, gtk_builder_get_object (builder, "login-shell-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_VISIBLE_NAME_KEY, gtk_builder_get_object (builder, "profile-name-entry"), "text", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_LINES_KEY, gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (gtk_builder_get_object (builder, "scrollback-lines-spinbutton"))), "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY, gtk_builder_get_object (builder, "scrollback-limited-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_INVERT_BOOLEAN); g_settings_bind (profile, TERMINAL_PROFILE_SCROLLBACK_UNLIMITED_KEY, gtk_builder_get_object (builder, "scrollback-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_with_mapping (profile, TERMINAL_PROFILE_SCROLLBAR_POLICY_KEY, gtk_builder_get_object (builder, "scrollbar-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET, (GSettingsBindGetMapping) scrollbar_policy_to_bool, (GSettingsBindSetMapping) bool_to_scrollbar_policy, NULL, NULL); g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_KEYSTROKE_KEY, gtk_builder_get_object (builder, "scroll-on-keystroke-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_SCROLL_ON_OUTPUT_KEY, gtk_builder_get_object (builder, "scroll-on-output-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY, gtk_builder_get_object (builder, "custom-font-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET | G_SETTINGS_BIND_INVERT_BOOLEAN); g_settings_bind (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY, gtk_builder_get_object (builder, "use-custom-command-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY, gtk_builder_get_object (builder, "use-theme-colors-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_AUDIBLE_BELL_KEY, gtk_builder_get_object (builder, "bell-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_CUSTOM_COMMAND_KEY, gtk_builder_get_object (builder, "custom-command-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind (profile, TERMINAL_PROFILE_USE_SYSTEM_FONT_KEY, gtk_builder_get_object (builder, "font-selector"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_COLORS_KEY, gtk_builder_get_object (builder, "colors-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind_writable (profile, TERMINAL_PROFILE_PALETTE_KEY, gtk_builder_get_object (builder, "palette-box"), "sensitive", FALSE); g_settings_bind (profile, TERMINAL_PROFILE_REWRAP_ON_RESIZE_KEY, gtk_builder_get_object (builder, "rewrap-on-resize-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); /* Compatibility options */ w = (GtkWidget *) gtk_builder_get_object (builder, "encoding-combobox"); init_encodings_combo (w); g_settings_bind (profile, TERMINAL_PROFILE_ENCODING_KEY, w, "active-id", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); w = (GtkWidget *) gtk_builder_get_object (builder, "cjk-ambiguous-width-combobox"); g_settings_bind (profile, TERMINAL_PROFILE_CJK_UTF8_AMBIGUOUS_WIDTH_KEY, w, "active-id", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND, gtk_builder_get_object (builder, "use-transparent-background"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_TRANSPARENT_BACKGROUND, gtk_builder_get_object (builder, "background-transparent-scale-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_NO_SENSITIVITY); g_settings_bind (profile, TERMINAL_PROFILE_BACKGROUND_TRANSPARENCY_PERCENT, gtk_builder_get_object (builder, "background-transparent-adjustment"), "value", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); g_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_TRANSPARENCY, gtk_builder_get_object (builder, "use-theme-transparency-checkbutton"), "active", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET); if (style_darkness >= 0) g_settings_bind (profile, TERMINAL_PROFILE_USE_THEME_TRANSPARENCY, gtk_builder_get_object (builder, "use-transparent-background-box"), "sensitive", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_INVERT_BOOLEAN | G_SETTINGS_BIND_NO_SENSITIVITY); /* Finished! */ terminal_util_bind_mnemonic_label_sensitivity (editor); terminal_util_dialog_focus_widget (editor, widget_name); gtk_window_set_transient_for (GTK_WINDOW (editor), NULL); gtk_window_present (GTK_WINDOW (editor)); }