static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data) { CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv; gboolean allowed, auto_timezone, using_ntp; allowed = (priv->permission != NULL && g_permission_get_allowed (priv->permission)); using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch"))); auto_timezone = gtk_switch_get_active (GTK_SWITCH (W("auto_timezone_switch"))); /* All the widgets but the lock button and the 24h setting */ gtk_widget_set_sensitive (W("auto-datetime-row"), allowed); gtk_widget_set_sensitive (W("auto-timezone-row"), allowed); gtk_widget_set_sensitive (W("datetime-button"), allowed && !using_ntp); gtk_widget_set_sensitive (W("timezone-button"), allowed && !auto_timezone); /* Hide the subdialogs if we no longer have permissions */ if (!allowed) { gtk_widget_hide (GTK_WIDGET (W ("datetime-dialog"))); gtk_widget_hide (GTK_WIDGET (W ("timezone-dialog"))); } }
void settings_conf_save (void) { char PathConfFile [512]; #ifdef __linux__ sprintf(PathConfFile ,"%s/settings.ini" ,DirConf); #elif __WIN32 sprintf(PathConfFile ,"%s\\settings.ini" ,DirConf); #endif FILE *fpConfig = fopen(PathConfFile , "w"); if (fpConfig == NULL) { log_error(true,"***Error: Couldn't write to config file 'settings.ini'"); return; } const char *pEntryBuff; fprintf(fpConfig,"UM_Preview = %d\n", gtk_switch_get_active(GTK_SWITCH(sw_um_pp))); fprintf(fpConfig,"UM_AnimPreview = %d\n", gtk_switch_get_active(GTK_SWITCH(sw_um_ap))); fprintf(fpConfig,"UM_DoubleClick = %d\n", gtk_switch_get_active(GTK_SWITCH(sw_um_dc))); fprintf(fpConfig,"UM_DC_Action = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(com_um_dca))); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_um_win_w)); fprintf(fpConfig,"UM_Win_W = %s\n", pEntryBuff ); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_um_win_h)); fprintf(fpConfig,"UM_Win_H = %s\n", pEntryBuff ); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_um_pw_w)); fprintf(fpConfig,"UM_Prev_Size_W = %s\n", pEntryBuff ); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_um_pw_h)); fprintf(fpConfig,"UM_Prev_Size_H = %s\n", pEntryBuff ); fprintf(fpConfig,"UM_Win_Pos = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(com_um_wp))); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_uq_win_w)); fprintf(fpConfig,"UQ_Win_W = %s\n", pEntryBuff ); pEntryBuff = gtk_entry_get_text(GTK_ENTRY(entry_uq_win_h)); fprintf(fpConfig,"UQ_Win_H = %s\n", pEntryBuff ); fprintf(fpConfig,"UQ_Win_Pos = %d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(com_uq_wp))); fprintf(fpConfig,"UP_ProfileName = %s\n", gtk_label_get_text(GTK_LABEL(lab_profile))); fprintf(fpConfig,"UP_Keep_SS = %d\n", gtk_switch_get_active(GTK_SWITCH(sw_up_kss))); fclose(fpConfig); pEntryBuff = NULL; settings_window_destroy(); settings_conf_load(); }
JNIEXPORT jboolean JNICALL Java_org_gnome_gtk_GtkSwitch_gtk_1switch_1get_1active ( JNIEnv* env, jclass cls, jlong _self ) { gboolean result; jboolean _result; GtkSwitch* self; // convert parameter self self = (GtkSwitch*) _self; // call function result = gtk_switch_get_active(self); // cleanup parameter self // translate return value to JNI type _result = (jboolean) result; // and finally return _result; }
static gboolean gis_privacy_page_apply (GisPage *gis_page, GCancellable *cancellable) { GisPrivacyPage *page = GIS_PRIVACY_PAGE (gis_page); GisPrivacyPagePrivate *priv = gis_privacy_page_get_instance_private (page); gboolean active; active = gtk_switch_get_active (GTK_SWITCH (priv->location_switch)); g_settings_set_boolean (priv->location_settings, "enabled", active); active = gtk_switch_get_active (GTK_SWITCH (priv->reporting_switch)); g_settings_set_boolean (priv->privacy_settings, "report-technical-problems", active); return FALSE; }
void on_switch_icon_active_notify(GtkSwitch *widget, gpointer data) { g_settings_set_boolean(settings, "dark-icon", gtk_switch_get_active(widget)); update_tray(); }
void on_switch_startup_active_notify(GtkSwitch *widget, gpointer data) { gchar *folder_dir, *startup_dir, *desktop_dir; GFile *folder_file, *startup_file, *desktop_file; folder_dir = g_build_filename(g_get_home_dir(), ".config", "autostart", NULL); startup_dir = g_build_filename(g_get_home_dir(), ".config", "autostart", "acal.desktop", NULL); desktop_dir = g_build_filename(DATADIR, "applications", "acal.desktop", NULL); folder_file = g_file_new_for_path(folder_dir); startup_file = g_file_new_for_path(startup_dir); desktop_file = g_file_new_for_path(desktop_dir); /* create startup folder if not exists */ g_file_make_directory_with_parents(folder_file , NULL, NULL); /* copy acal.desktop to autostart dir on activate autostart */ if(gtk_switch_get_active(widget)) g_file_copy(desktop_file, startup_file, G_FILE_COPY_NONE, NULL, NULL, NULL, NULL); else g_file_delete(startup_file, NULL, NULL); }
static gboolean gtk_technology_button_release_event(GtkWidget *widget, GdkEventButton *event) { GtkTechnology *technology = GTK_TECHNOLOGY(widget); GtkTechnologyPrivate *priv = technology->priv; gboolean enable; if (event->button != 1 && event->button != 3) return TRUE; if (event->button == 3) { GtkWidget *parent; const char *type; type = connman_technology_get_type(technology->path); if (g_strcmp0(type, "wifi") == 0) cui_agent_set_wifi_tethering_settings(technology->path, FALSE); parent = gtk_widget_get_parent (widget); if (parent != NULL && GTK_IS_MENU_SHELL(parent) == TRUE) { GtkMenuShell *menu_shell = GTK_MENU_SHELL(parent); gtk_menu_shell_activate_item(menu_shell, widget, TRUE); } return TRUE; } enable = !gtk_switch_get_active(priv->enabler); if (connman_technology_enable(technology->path, enable) == 0) gtk_widget_set_sensitive((GtkWidget *)priv->enabler, FALSE); return TRUE; }
static void device_off_toggled (GtkSwitch *sw, GParamSpec *pspec, NetDeviceEthernet *device) { NMClient *client; NMDevice *nm_device; NMConnection *connection; NMActiveConnection *a; if (device->updating_device) return; client = net_object_get_client (NET_OBJECT (device)); nm_device = net_device_get_nm_device (NET_DEVICE (device)); if (gtk_switch_get_active (sw)) { connection = net_device_get_find_connection (NET_DEVICE (device)); if (connection != NULL) { nm_client_activate_connection (client, connection, nm_device, NULL, NULL, NULL); } } else { a = nm_device_get_active_connection (nm_device); if (a) { nm_client_deactivate_connection (client, a); } } }
static void autologin_changed (GObject *object, GParamSpec *pspec, UmUserPanelPrivate *d) { gboolean active; UmUser *user; active = gtk_switch_get_active (GTK_SWITCH (object)); user = get_selected_user (d); if (active != um_user_get_automatic_login (user)) { um_user_set_automatic_login (user, active); if (um_user_get_automatic_login (user)) { GSList *list; GSList *l; list = um_user_manager_list_users (d->um); for (l = list; l != NULL; l = l->next) { UmUser *u = l->data; if (um_user_get_uid (u) != um_user_get_uid (user)) { um_user_set_automatic_login (user, FALSE); } } g_slist_free (list); } } g_object_unref (user); }
static void change_ntp (GObject *gobject, GParamSpec *pspec, CcDateTimePanel *self) { update_widget_state_for_ntp (self, gtk_switch_get_active (GTK_SWITCH (gobject))); queue_set_ntp (self); }
static void dialog_enabled_notify_cb (GtkSwitch *sw, GParamSpec *pspec, CcNightLightDialog *self) { g_settings_set_boolean (self->settings_display, "night-light-enabled", gtk_switch_get_active (sw)); }
static void toggle (GtkSwitch *sw, GParamSpec *pspec, GtkLevelBar *bar) { if (gtk_switch_get_active (sw)) gtk_level_bar_set_mode (bar, GTK_LEVEL_BAR_MODE_DISCRETE); else gtk_level_bar_set_mode (bar, GTK_LEVEL_BAR_MODE_CONTINUOUS); }
static void toggle_switch (GtkWidget *sw) { gboolean active; active = gtk_switch_get_active (GTK_SWITCH (sw)); gtk_switch_set_active (GTK_SWITCH (sw), !active); }
void keybinds_conf_save (void) { int i; int Mod1[HOTKEY_COUNT], Mod2[HOTKEY_COUNT] , Key[HOTKEY_COUNT]; char sMods[5][10] = { "" , "<CTRL>", "<SHIFT>", "<ALT>", "<WIN>" }; char ConfFilePath [512]; FILE *fpConfig = NULL; #ifdef __linux__ sprintf(ConfFilePath ,"%s/keybinds.ini" ,DirConf); #elif __WIN32 sprintf(ConfFilePath ,"%s\\keybinds.ini" ,DirConf); #endif fpConfig = fopen(ConfFilePath , "w"); if (fpConfig == NULL) { log_error(true,"***Error: Couldn't write to config file 'keybinds.ini'"); return; } for ( i = 0 ; i < HOTKEY_COUNT ; ++i) { Mod1[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_mod1[i])); Mod2[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_mod2[i])); Key[i] = gtk_combo_box_get_active(GTK_COMBO_BOX(com_kb_key[i])); } fprintf(fpConfig, "Hotkey_FUP = %s%s%c\n", Mod1[0] != Mod2[0] ? sMods[Mod1[0]] : "" , sMods[Mod2[0]], Key[0]+33); fprintf(fpConfig, "Hotkey_SS_A_UP = %s%s%c\n", Mod1[1] != Mod2[1] ? sMods[Mod1[1]] : "" , sMods[Mod2[1]], Key[1]+33); fprintf(fpConfig, "Hotkey_SS_W_UP = %s%s%c\n", Mod1[2] != Mod2[2] ? sMods[Mod1[2]] : "" , sMods[Mod2[2]], Key[2]+33); fprintf(fpConfig, "Hotkey_SS_F_UP = %s%s%c\n", Mod1[3] != Mod2[3] ? sMods[Mod1[3]] : "" , sMods[Mod2[3]], Key[3]+33); fprintf(fpConfig, "Hotkey_SS_A_CAP = %s%s%c\n", Mod1[4] != Mod2[4] ? sMods[Mod1[4]] : "" , sMods[Mod2[4]], Key[4]+33); fprintf(fpConfig, "Hotkey_SS_W_CAP = %s%s%c\n", Mod1[5] != Mod2[5] ? sMods[Mod1[5]] : "" , sMods[Mod2[5]], Key[5]+33); fprintf(fpConfig, "Hotkey_SS_F_CAP = %s%s%c\n", Mod1[6] != Mod2[6] ? sMods[Mod1[6]] : "" , sMods[Mod2[6]], Key[6]+33); fprintf(fpConfig, "Hotkey_OPEN = %s%s%c\n", Mod1[7] != Mod2[7] ? sMods[Mod1[7]] : "" , sMods[Mod2[7]], Key[7]+33); fprintf(fpConfig, "Enable_HK_FUP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[0]))); fprintf(fpConfig, "Enable_HK_SS_A_UP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[1]))); fprintf(fpConfig, "Enable_HK_SS_W_UP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[2]))); fprintf(fpConfig, "Enable_HK_SS_F_UP = %d\n",gtk_switch_get_active (GTK_SWITCH(sw_kb[3]))); fprintf(fpConfig, "Enable_HK_SS_A_CAP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[4]))); fprintf(fpConfig, "Enable_HK_SS_W_CAP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[5]))); fprintf(fpConfig, "Enable_HK_SS_F_CAP = %d\n", gtk_switch_get_active (GTK_SWITCH(sw_kb[6]))); fprintf(fpConfig, "Enable_HK_OPEN = %d\n",gtk_switch_get_active (GTK_SWITCH(sw_kb[7]))); fclose(fpConfig); keybinds_window_destroy(); keybinds_conf_load(); }
void on_Distance_Switch_state_flags_changed (GtkSwitch *button, gpointer user_data) { gboolean onSw; if (button == NULL && user_data == NULL) { /* Bogus condition to use parameters */ ; } onSw = gtk_switch_get_active(button); gtk_widget_set_sensitive ((GtkWidget *)uoptions_Distance_Input, onSw); dist_state = onSw; }
static void BSWITCH(GtkSwitch *sw, GTKwrapper *state){ int BOOL = (int)gtk_switch_get_active((GtkSwitch*)sw); if (BOOL){ setBiasON(gpibHANDLE); } else { setBiasOFF(gpibHANDLE); } }
static gboolean property_page_commit (PropertyPage *page) { gboolean is_shared; ShareInfo share_info; ConfirmPermissionsStatus status; GError *error; gboolean retval; is_shared = gtk_switch_get_active (GTK_SWITCH (page->switch_share_folder)); share_info.path = page->path; share_info.share_name = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_name)); share_info.comment = (char *) gtk_entry_get_text (GTK_ENTRY (page->entry_share_comment)); share_info.is_writable = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_rw_ro)); share_info.guest_ok = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->checkbutton_share_guest_ok)); /* Do we need to unset the write permissions that we added in the past? */ if (is_shared && page->was_writable && !share_info.is_writable) restore_write_permissions (page->path); status = confirm_sharing_permissions (page->main, page->path, is_shared, share_info.guest_ok, share_info.is_writable); if (status == CONFIRM_CANCEL_OR_ERROR) return FALSE; /* the user didn't want us to change his folder's permissions */ error = NULL; retval = shares_modify_share (share_info.path, is_shared ? &share_info : NULL, &error); if (!retval) { property_page_set_error (page, error->message); g_error_free (error); /* Since the operation failed, we restore things to the way they were */ if (status == CONFIRM_MODIFIED) restore_saved_permissions (page->path); } else { property_page_validate_fields (page); nemo_file_info_invalidate_extension_info (page->fileinfo); } if (!is_shared) restore_saved_permissions (page->path); /* update initially shared state, so that we may undo later on */ if (retval) { page->was_initially_shared = is_shared; page->is_dirty = FALSE; } return retval; }
/* flashlight_on_toggled */ static void _flashlight_on_toggled(gpointer data) { Flashlight * flashlight = data; #if GTK_CHECK_VERSION(3, 0, 0) flashlight_set_active(flashlight, gtk_switch_get_active( GTK_SWITCH(flashlight->co_toggle))); #else flashlight_set_active(flashlight, gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(flashlight->co_toggle))); #endif }
static void aspectswitch_toggled_cb (GtkWidget *widget, GParamSpec *pspec, CcWacomMappingPanel *self) { GSettings *settings; settings = gsd_wacom_device_get_settings (self->priv->device); g_settings_set_boolean (settings, "keep-aspect", gtk_switch_get_active (GTK_SWITCH (widget))); }
void lfo_on_tempo_sync_changed( GtkSwitch *tsyncSwitch, GParamSpec *pspec, gpointer user_data) { LfoPanel_int *panel = (LfoPanel_int*) user_data; TempoSync newStatus = gtk_switch_get_active(tsyncSwitch); if(newStatus != panel->tempo_sync) { lfo_panel_change_layout(panel,newStatus); } }
static void on_notify_active (GtkSwitch *widget, GParamSpec *pspec, NimfSettingsPageKey *page_key) { gboolean active1; gboolean active2; active1 = gtk_switch_get_active (GTK_SWITCH (widget)); active2 = g_settings_get_boolean (page_key->gsettings, page_key->key); if (active1 != active2) g_settings_set_boolean (page_key->gsettings, page_key->key, active1); }
static void queue_set_ntp (CcDateTimePanel *self) { CcDateTimePanelPrivate *priv = self->priv; gboolean using_ntp; /* for now just do it */ using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch"))); date_time_mechanism_call_set_using_ntp (self->priv->dtm, using_ntp, self->priv->cancellable, set_using_ntp_cb, self); }
static void left_handed_toggled_cb (GtkSwitch *sw, GParamSpec *pspec, gpointer *user_data) { CcWacomPagePrivate *priv = CC_WACOM_PAGE(user_data)->priv; CsdWacomDevice *device = priv->stylus; CsdWacomRotation display_rotation; const gchar* rotation; display_rotation = csd_wacom_device_get_display_rotation (device); rotation = csd_wacom_device_rotation_type_to_name (display_rotation); if (gtk_switch_get_active (sw)) rotation = opposite_rotation (rotation); g_settings_set_string (priv->wacom_settings, "rotation", rotation); }
static AtkStateSet * gtk_switch_accessible_ref_state_set (AtkObject *accessible) { AtkStateSet *state_set; GtkWidget *widget; state_set = ATK_OBJECT_CLASS (_gtk_switch_accessible_parent_class)->ref_state_set (accessible); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible)); if (widget == NULL) return state_set; if (gtk_switch_get_active (GTK_SWITCH (widget))) atk_state_set_add_state (state_set, ATK_STATE_CHECKED); return state_set; }
static void on_gsettings_changed (GSettings *settings, gchar *key, GtkWidget *widget) { if (GTK_IS_SWITCH (widget)) { gboolean active1 = g_settings_get_boolean (settings, key); gboolean active2 = gtk_switch_get_active (GTK_SWITCH (widget)); if (active1 != active2) gtk_switch_set_active (GTK_SWITCH (widget), active1); } else if (GTK_IS_COMBO_BOX (widget)) { gchar *id; gboolean retval; id = g_settings_get_string (settings, key); retval = gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), id); if (retval == FALSE && g_strcmp0 (key, "default-engine") == 0) g_settings_set_string (settings, key, "nimf-system-keyboard"); g_free (id); } else if (GTK_IS_TREE_VIEW (widget)) { GtkTreeModel *model; gchar **vals; GtkTreeIter iter; gint i; vals = g_settings_get_strv (settings, key); model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); gtk_list_store_clear (GTK_LIST_STORE (model)); for (i = 0; vals[i] != NULL; i++) { gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, vals[i], -1); } g_strfreev (vals); } }
static void explain_activate (GObject *gobject, GParamSpec *pspec, gpointer user_data) { GPInstructLessonTestMultiChoiceEditor *editor = GPINSTRUCT_LESSON_TEST_MULTI_CHOICE_EDITOR (user_data); GPInstructLessonTestMultiChoiceEditorPrivate *priv = editor->priv; gboolean active = gtk_switch_get_active (GTK_SWITCH (priv->explain_switch)); if (active != gpinstruct_lesson_test_get_explain (GPINSTRUCT_LESSON_TEST (priv->test))) { gpinstruct_lesson_test_set_explain (GPINSTRUCT_LESSON_TEST (priv->test), active); gpinstruct_editor_window_set_modified (priv->window, TRUE); } }
static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data) { CcDateTimePanelPrivate *priv = CC_DATE_TIME_PANEL (data)->priv; gboolean allowed, using_ntp; allowed = g_permission_get_allowed (permission); using_ntp = gtk_switch_get_active (GTK_SWITCH (W("network_time_switch"))); /* All the widgets but the lock button and the 24h setting */ gtk_widget_set_sensitive (W("map-vbox"), allowed); gtk_widget_set_sensitive (W("hbox2"), allowed); gtk_widget_set_sensitive (W("alignment2"), allowed); gtk_widget_set_sensitive (W("table1"), allowed && !using_ntp); }
/* flashlight_get_active */ gboolean flashlight_get_active(Flashlight * flashlight) { switch(flashlightbackend_get()) { case FBA_ACTIVE: return TRUE; case FBA_INACTIVE: return FALSE; default: #if GTK_CHECK_VERSION(3, 0, 0) return gtk_switch_get_active(GTK_SWITCH( flashlight->co_toggle)); #else return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( flashlight->co_toggle)); #endif } }
static void property_page_check_sensitivity (PropertyPage *page) { gboolean enabled; gboolean apply_is_sensitive; enabled = gtk_switch_get_active (GTK_SWITCH (page->switch_share_folder)); property_page_set_controls_sensitivity (page, enabled); if (enabled) apply_is_sensitive = page->is_dirty || !page->was_initially_shared; else apply_is_sensitive = page->was_initially_shared; gtk_widget_set_sensitive (page->button_apply, apply_is_sensitive); gtk_button_set_label (GTK_BUTTON(page->button_apply), page->was_initially_shared ? _("Modify _Share") : _("Create _Share")); }
static void power_callback (GObject *object, GParamSpec *spec, CcBluetoothPanel *self) { gboolean state; state = gtk_switch_get_active (GTK_SWITCH (WID ("switch_bluetooth"))); g_debug ("Power switched to %s", state ? "on" : "off"); g_dbus_proxy_call (self->priv->properties, "Set", g_variant_new_parsed ("('org.gnome.SettingsDaemon.Rfkill', 'BluetoothAirplaneMode', %v)", g_variant_new_boolean (!state)), G_DBUS_CALL_FLAGS_NONE, -1, self->priv->cancellable, NULL, NULL); }