static void edit_plugin_clear_widgets (PluginEditorDialog *dlg) { gtk_entry_set_text (dlg->plugin_name, _("New Item")); gtk_file_chooser_unselect_all (dlg->plugin_path); gtk_entry_set_text (dlg->plugin_tooltip, ""); }
static void project_css_provider_path_changed (GladeProject *project, GParamSpec *pspec, GladeProjectProperties *properties) { GladeProjectPropertiesPrivate *priv = properties->priv; const gchar *filename = glade_project_get_css_provider_path (project); GtkFileChooser *chooser = GTK_FILE_CHOOSER (priv->css_filechooser); priv->ignore_ui_cb = TRUE; if (filename) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->css_checkbutton), TRUE); gtk_widget_set_sensitive (priv->css_filechooser, TRUE); gtk_file_chooser_set_filename (chooser, filename); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->css_checkbutton), FALSE); gtk_widget_set_sensitive (priv->css_filechooser, FALSE); gtk_file_chooser_unselect_all (chooser); } priv->ignore_ui_cb = FALSE; }
static void panel_properties_dialog_setup_image_chooser (PanelPropertiesDialog *dialog, GtkBuilder *gui) { char *image; dialog->image_chooser = PANEL_GTK_BUILDER_GET (gui, "image_chooser"); panel_gtk_file_chooser_add_image_preview (GTK_FILE_CHOOSER (dialog->image_chooser)); image = panel_profile_get_background_image (dialog->toplevel); if (PANEL_GLIB_STR_EMPTY (image)) gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser)); else gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser), image); if (image) g_free (image); dialog->selection_emitted = 0; g_signal_connect_swapped (dialog->image_chooser, "selection-changed", G_CALLBACK (panel_properties_dialog_image_changed), dialog); if ( ! panel_profile_background_key_is_writable (dialog->toplevel, "image")) { gtk_widget_set_sensitive (dialog->image_chooser, FALSE); gtk_widget_show (dialog->writability_warn_background); } }
static void gfire_game_manager_reload_ui() { if(!gfire_gtk_builder) return; GtkWidget *add_game_entry = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_game_entry")); GtkWidget *add_detection_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_detection_button")); GtkWidget *add_executable_check_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_executable_check_button")); GtkWidget *add_launch_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_launch_button")); GtkWidget *add_advanced_expander = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_advanced_expander")); GtkWidget *add_prefix_entry = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "add_prefix_entry")); GtkWidget *edit_game_combo = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "edit_game_combo")); GtkListStore *edit_game_list_store = GTK_LIST_STORE(gtk_builder_get_object(gfire_gtk_builder, "edit_game_list_store")); GtkWidget *edit_detection_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "edit_detection_button")); GtkWidget *edit_executable_check_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "edit_executable_check_button")); GtkWidget *edit_launch_button = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "edit_launch_button")); GtkWidget *edit_prefix_entry = GTK_WIDGET(gtk_builder_get_object(gfire_gtk_builder, "edit_prefix_entry")); // Reset widgets on "add" tab gtk_entry_set_text(GTK_ENTRY(add_game_entry), ""); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(add_detection_button)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(add_executable_check_button), TRUE); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(add_launch_button)); gtk_expander_set_expanded(GTK_EXPANDER(add_advanced_expander), FALSE); gtk_entry_set_text(GTK_ENTRY(add_prefix_entry), ""); // Reset widgets on "edit" tab gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(edit_detection_button)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(edit_executable_check_button), TRUE); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(edit_launch_button)); gtk_entry_set_text(GTK_ENTRY(edit_prefix_entry), ""); // Clear games list combo box gtk_list_store_clear(edit_game_list_store); // Add all new configured games GList *cur = gfire_games_config; while(cur) { const gfire_game *game = gfire_game_by_id(((gfire_game_configuration*)cur->data)->game_id); if(game) { gtk_combo_box_append_text(GTK_COMBO_BOX(edit_game_combo), game->name); } cur = g_list_next(cur); } }
void cb_clear_file(GtkWidget * button, gpointer p) { SettingItem * item = p; check_file(item,""); item->fvalue=""; gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(item->widget)); write_setting(p,global_theme_file); if (apply) apply_settings(); }
static gboolean dlg_clear_image_file(GtkWidget* widget, GdkEventKey* event, gpointer user_data) { struct TermitTab* pTab = (struct TermitTab*)user_data; if (event->keyval == GDK_KEY_Delete) { if (pTab->style.image_file) { gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(widget)); termit_tab_set_background_image(pTab, NULL); } } return FALSE; }
static void update_prefs_for_resource_path (GladeProjectProperties *properties) { GladeProjectPropertiesPrivate *priv = properties->priv; const gchar *resource_path; resource_path = glade_project_get_resource_path (priv->project); if (resource_path == NULL) { gtk_entry_set_text (GTK_ENTRY (priv->relative_path_entry), ""); gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (priv->full_path_button)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->resource_default_radio), TRUE); gtk_widget_set_sensitive (priv->full_path_button, FALSE); gtk_widget_set_sensitive (priv->relative_path_entry, FALSE); } else if (g_path_is_absolute (resource_path) && g_file_test (resource_path, G_FILE_TEST_IS_DIR)) { gtk_entry_set_text (GTK_ENTRY (priv->relative_path_entry), ""); gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (priv->full_path_button), resource_path); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->resource_fullpath_radio), TRUE); gtk_widget_set_sensitive (priv->full_path_button, TRUE); gtk_widget_set_sensitive (priv->relative_path_entry, FALSE); } else { if (g_strcmp0 (resource_path, gtk_entry_get_text (GTK_ENTRY (priv->relative_path_entry)))) gtk_entry_set_text (GTK_ENTRY (priv->relative_path_entry), resource_path); gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (priv->full_path_button)); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->resource_relative_radio), TRUE); gtk_widget_set_sensitive (priv->relative_path_entry, TRUE); gtk_widget_set_sensitive (priv->full_path_button, FALSE); } }
int clip_GTK_FILECHOOSERUNSELECTALL(ClipMachine * ClipMachineMemory) { C_object *cchooser = _fetch_co_arg(ClipMachineMemory); CHECKCOBJ(cchooser, GTK_IS_FILE_CHOOSER(cchooser->object)); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(cchooser->object)); return 0; err: return 1; }
static void private_key_picker_helper (EAPMethod *parent, const char *filename, gboolean changed) { NMSetting8021x *setting; NMSetting8021xCKFormat cert_format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN; const char *password; GtkWidget *widget; widget = glade_xml_get_widget (parent->xml, "eap_tls_private_key_password_entry"); g_assert (widget); password = gtk_entry_get_text (GTK_ENTRY (widget)); setting = (NMSetting8021x *) nm_setting_802_1x_new (); nm_setting_802_1x_set_private_key (setting, filename, password, NM_SETTING_802_1X_CK_SCHEME_PATH, &cert_format, NULL); g_object_unref (setting); /* With PKCS#12, the client cert must be the same as the private key */ widget = glade_xml_get_widget (parent->xml, "eap_tls_user_cert_button"); if (cert_format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) { gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget)); gtk_widget_set_sensitive (widget, FALSE); } else if (changed) gtk_widget_set_sensitive (widget, TRUE); /* Warn the user if the private key is unencrypted */ if (!eap_method_is_encrypted_private_key (filename)) { GtkWidget *dialog; GtkWidget *toplevel; GtkWindow *parent_window = NULL; toplevel = gtk_widget_get_toplevel (parent->ui_widget); #if GTK_CHECK_VERSION(2,18,0) if (gtk_widget_is_toplevel (toplevel)) #else if (GTK_WIDGET_TOPLEVEL (toplevel)) #endif parent_window = GTK_WINDOW (toplevel); dialog = gtk_message_dialog_new (parent_window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "%s", _("Unencrypted private keys are insecure")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", _("The selected private key does not appear to be protected by a password. This could allow your security credentials to be compromised. Please select a password-protected private key.\n\n(You can password-protect your private key with openssl)")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } }
static void panel_properties_dialog_image_changed (GSettings *settings, char *key, PanelPropertiesDialog *dialog) { char *uri = g_settings_get_string (dialog->priv->settings_background, PANEL_BACKGROUND_IMAGE_KEY); if (!uri) { gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->priv->filechooser_button)); } else { gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog->priv->filechooser_button), uri); } g_free (uri); }
static void panel_properties_dialog_background_image_update (PanelPropertiesDialog *dialog) { char *uri; uri = g_settings_get_string (dialog->settings_background, PANEL_BACKGROUND_IMAGE_URI_KEY); if (PANEL_GLIB_STR_EMPTY (uri)) gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser)); else gtk_file_chooser_set_uri (GTK_FILE_CHOOSER (dialog->image_chooser), uri); g_free (uri); }
static void panel_properties_dialog_setup_image_chooser (PanelPropertiesDialog *dialog, GladeXML *gui) { GtkFileFilter *filter; GtkWidget *chooser_preview; char *image; dialog->image_chooser = glade_xml_get_widget (gui, "image_chooser"); filter = gtk_file_filter_new (); gtk_file_filter_set_name (filter, _("Images")); gtk_file_filter_add_pixbuf_formats (filter); gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog->image_chooser), filter); gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog->image_chooser), filter); chooser_preview = gtk_image_new (); gtk_file_chooser_set_preview_widget (GTK_FILE_CHOOSER (dialog->image_chooser), chooser_preview); g_signal_connect (dialog->image_chooser, "update-preview", G_CALLBACK (panel_properties_dialog_chooser_preview_update), chooser_preview); image = panel_profile_get_background_image (dialog->toplevel); if (string_empty (image)) gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser)); else gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser), image); if (image) g_free (image); dialog->selection_emitted = 0; g_signal_connect_swapped (dialog->image_chooser, "selection-changed", G_CALLBACK (panel_properties_dialog_image_changed), dialog); if ( ! panel_profile_is_writable_background_image (dialog->toplevel)) { gtk_widget_set_sensitive (dialog->image_chooser, FALSE); gtk_widget_show (dialog->writability_warn_background); } }
static void panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, gchar *text) { char *old_text; old_text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog->image_chooser)); if (PANEL_GLIB_STR_EMPTY (text) && old_text) gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser)); else if (!PANEL_GLIB_STR_EMPTY (text) && (!old_text || strcmp (text, old_text))) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser), text); if (old_text) g_free (old_text); }
JNIEXPORT void JNICALL Java_org_gnome_gtk_GtkFileChooser_gtk_1file_1chooser_1unselect_1all ( JNIEnv* env, jclass cls, jlong _self ) { GtkFileChooser* self; // convert parameter self self = (GtkFileChooser*) _self; // call function gtk_file_chooser_unselect_all(self); // cleanup parameter self }
static void dlg_set_default_values(struct TermitDlgHelper* hlp) { gtk_entry_set_text(GTK_ENTRY(hlp->entry_title), hlp->tab_title); gtk_font_button_set_font_name(GTK_FONT_BUTTON(hlp->btn_font), hlp->style.font_name); if (hlp->style.foreground_color) { gtk_color_button_set_color(GTK_COLOR_BUTTON(hlp->btn_foreground), hlp->style.foreground_color); } if (hlp->style.background_color) { gtk_color_button_set_color(GTK_COLOR_BUTTON(hlp->btn_background), hlp->style.background_color); } gtk_spin_button_set_value(GTK_SPIN_BUTTON(hlp->scale_transparency), hlp->style.transparency); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hlp->audible_bell), hlp->au_bell); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(hlp->visible_bell), hlp->vi_bell); if (hlp->style.image_file) { gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(hlp->btn_image_file), hlp->style.image_file); } else { gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(hlp->btn_image_file)); } }
static void SetFileChooserButton( GtkWidget *widget, WidgetData *wdata, _FileChooserButton *data) { GtkFileChooserButton *fcb; gchar *folder; char *longname; ENTER_FUNC; SetCommon(widget,wdata); fcb = GTK_FILE_CHOOSER_BUTTON(widget); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(fcb)); longname = (char *)glade_get_widget_long_name(widget); folder = GetWidgetCache(longname); if (folder == NULL) { folder = ""; } gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fcb),folder); _AddChangedWidget(widget); LEAVE_FUNC; }
static void panel_properties_dialog_update_background_image (PanelPropertiesDialog *dialog, GConfValue *value) { const char *text; char *old_text; if (!value || value->type != GCONF_VALUE_STRING) return; text = gconf_value_get_string (value); old_text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog->image_chooser)); if (string_empty (text) && old_text) gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (dialog->image_chooser)); else if (!string_empty (text) && (!old_text || strcmp (text, old_text))) gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog->image_chooser), text); if (old_text) g_free (old_text); }
static void private_key_picker_helper (EAPMethod *parent, const char *filename, gboolean changed) { NMSetting8021x *setting; NMSetting8021xCKType cert_type = NM_SETTING_802_1X_CK_TYPE_UNKNOWN; const char *password; GtkWidget *widget; widget = glade_xml_get_widget (parent->xml, "eap_tls_private_key_password_entry"); g_assert (widget); password = gtk_entry_get_text (GTK_ENTRY (widget)); setting = (NMSetting8021x *) nm_setting_802_1x_new (); nm_setting_802_1x_set_private_key_from_file (setting, filename, password, &cert_type, NULL); g_object_unref (setting); /* With PKCS#12, the client cert must be the same as the private key */ widget = glade_xml_get_widget (parent->xml, "eap_tls_user_cert_button"); if (cert_type == NM_SETTING_802_1X_CK_TYPE_PKCS12) { gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER (widget)); gtk_widget_set_sensitive (widget, FALSE); } else if (changed) gtk_widget_set_sensitive (widget, TRUE); }
static void build_tab_view(AccountSecurityTab *self) { g_return_if_fail(IS_ACCOUNT_SECURITY_TAB(self)); AccountSecurityTabPrivate *priv = ACCOUNT_SECURITY_TAB_GET_PRIVATE(self); gboolean not_ring = priv->account->protocol() != Account::Protocol::RING; /* SRTP */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_srtp), priv->account->isSrtpEnabled()); /* disable options if SRTP is off or if its a RING account */ gtk_widget_set_sensitive(priv->checkbutton_use_srtp, not_ring); gtk_widget_set_sensitive(priv->box_key_exchange, priv->account->isSrtpEnabled() && not_ring); gtk_widget_set_sensitive(priv->checkbutton_srtp_fallback, priv->account->isSrtpEnabled() && not_ring); g_signal_connect(priv->checkbutton_use_srtp, "toggled", G_CALLBACK(use_srtp_toggled), self); /* encryption key exchange type */ priv->key_exchange_selection = gtk_combo_box_set_qmodel( GTK_COMBO_BOX(priv->combobox_key_exchange), (QAbstractItemModel *)priv->account->keyExchangeModel(), priv->account->keyExchangeModel()->selectionModel()); /* SRTP fallback */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_srtp_fallback), priv->account->isSrtpRtpFallback()); g_signal_connect(priv->checkbutton_srtp_fallback, "toggled", G_CALLBACK(use_rtp_fallback_toggled), self); /* use TLS */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_tls), priv->account->isTlsEnabled()); /* disable certain options if TLS is off, or if its a RING account*/ gtk_widget_set_sensitive(priv->checkbutton_use_tls, not_ring); gtk_widget_set_sensitive(priv->grid_tls_settings_0, priv->account->isTlsEnabled()); gtk_widget_set_sensitive(priv->grid_tls_settings_1, priv->account->isTlsEnabled() && not_ring); gtk_widget_set_sensitive(priv->buttonbox_cipher_list, priv->account->isTlsEnabled() && not_ring); gtk_widget_set_sensitive(priv->treeview_cipher_list, priv->account->isTlsEnabled() && not_ring); gtk_widget_set_sensitive(priv->checkbutton_verify_certs_server, priv->account->isTlsEnabled() && not_ring); gtk_widget_set_sensitive(priv->checkbutton_verify_certs_client, priv->account->isTlsEnabled() && not_ring); gtk_widget_set_sensitive(priv->checkbutton_require_incoming_tls_certs, priv->account->isTlsEnabled() && not_ring); g_signal_connect(priv->checkbutton_use_tls, "toggled", G_CALLBACK(use_tls_toggled), self); /* CA certificate */ Certificate *ca_cert = priv->account->tlsCaListCertificate(); if (ca_cert) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(priv->filechooserbutton_ca_list), ca_cert->path().toUtf8().constData()); } g_signal_connect(priv->filechooserbutton_ca_list, "file-set", G_CALLBACK(ca_cert_file_set), self); /* user certificate */ if ( (priv->user_cert = priv->account->tlsCertificate()) ) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(priv->filechooserbutton_certificate), priv->user_cert->path().toUtf8().constData() ); } g_signal_connect(priv->filechooserbutton_certificate, "file-set", G_CALLBACK(user_cert_file_set), self); /* private key */ if (!priv->account->tlsPrivateKey().isEmpty()) { gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(priv->filechooserbutton_private_key), priv->account->tlsPrivateKey().toUtf8().constData() ); } g_signal_connect(priv->filechooserbutton_private_key, "file-set", G_CALLBACK(private_key_file_set), self); /* password */ check_tlspassword_valid(self); if (priv->user_cert && priv->user_cert->requirePrivateKeyPassword()) { gtk_entry_set_text( GTK_ENTRY(priv->entry_password), priv->account->tlsPassword().toUtf8().constData() ); gtk_widget_set_sensitive(priv->entry_password, TRUE); gtk_widget_set_sensitive(priv->label_private_key_password, TRUE); } else { /* private key not chosen, or password not required, so disactivate the entry */ gtk_widget_set_sensitive(priv->entry_password, FALSE); gtk_widget_set_sensitive(priv->label_private_key_password, FALSE); } g_signal_connect(priv->entry_password, "changed", G_CALLBACK(private_key_password_changed), self); /* TLS protocol method */ priv->tls_method_selection = gtk_combo_box_set_qmodel(GTK_COMBO_BOX(priv->combobox_tls_protocol_method), (QAbstractItemModel *)priv->account->tlsMethodModel(), priv->account->tlsMethodModel()->selectionModel()); /* outgoing TLS server */ gtk_entry_set_text(GTK_ENTRY(priv->entry_tls_server_name), priv->account->tlsServerName().toUtf8().constData()); g_signal_connect(priv->entry_tls_server_name, "changed", G_CALLBACK(tls_server_name_changed), self); /* TLS nego timeout */ gtk_adjustment_set_value(GTK_ADJUSTMENT(priv->adjustment_tls_timeout), priv->account->tlsNegotiationTimeoutSec()); g_signal_connect(priv->adjustment_tls_timeout, "value-changed", G_CALLBACK(tls_timeout_changed), self); /* cipher default or custom */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->radiobutton_use_default_ciphers), priv->account->cipherModel()->useDefault()); /* hide the cipher list if we're using the default ones */ gtk_revealer_set_reveal_child(GTK_REVEALER(priv->revealer_cipher_list), !priv->account->cipherModel()->useDefault()); g_signal_connect(priv->radiobutton_use_default_ciphers, "toggled", G_CALLBACK(use_default_ciphers_toggled), self); /* cipher list */ GtkQTreeModel *cipher_model = gtk_q_tree_model_new( (QAbstractItemModel *)priv->account->cipherModel(), 2, Qt::CheckStateRole, G_TYPE_BOOLEAN, Qt::DisplayRole, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(priv->treeview_cipher_list), GTK_TREE_MODEL(cipher_model)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(priv->treeview_cipher_list), FALSE); GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new(); GtkTreeViewColumn *column = gtk_tree_view_column_new_with_attributes( "Enabled", renderer, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(priv->treeview_cipher_list), column); /* we have to use a custom data function here because Qt::Checked and Qt::Unchecked * are not the same as true/false as there is an intermediate state */ gtk_tree_view_column_set_cell_data_func(column, renderer, (GtkTreeCellDataFunc)render_check_state, NULL, NULL); g_signal_connect(renderer, "toggled", G_CALLBACK(cipher_enable_toggled), self); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Cipher", renderer, "text", 1, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(priv->treeview_cipher_list), column); /* server certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_verify_certs_server), priv->account->isTlsVerifyServer()); g_signal_connect(priv->checkbutton_verify_certs_server, "toggled", G_CALLBACK(verify_certs_server_toggled), self); /* client certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_verify_certs_client), priv->account->isTlsVerifyClient()); g_signal_connect(priv->checkbutton_verify_certs_client, "toggled", G_CALLBACK(verify_certs_client_toggled), self); /* incoming certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_require_incoming_tls_certs), priv->account->isTlsRequireClientCertificate()); g_signal_connect(priv->checkbutton_require_incoming_tls_certs, "toggled", G_CALLBACK(require_incoming_certs_toggled), self); /* update account UI if model is updated */ priv->account_updated = QObject::connect( priv->account, &Account::changed, [=] () { /* SRTP */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_srtp), priv->account->isSrtpEnabled()); /* SRTP fallback */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_srtp_fallback), priv->account->isSrtpRtpFallback()); /* use TLS */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_use_tls), priv->account->isTlsEnabled()); /* CA certificate */ Certificate *ca_cert = priv->account->tlsCaListCertificate(); if (ca_cert) { gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(priv->filechooserbutton_ca_list), ca_cert->path().toUtf8().constData() ); } else { /* make sure nothing is selected */ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(priv->filechooserbutton_ca_list)); } /* user certificate */ QObject::disconnect(priv->cert_changed); if ( (priv->user_cert = priv->account->tlsCertificate()) ) { gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(priv->filechooserbutton_certificate), priv->user_cert->path().toUtf8().constData() ); } else { /* make sure nothing is selected */ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(priv->filechooserbutton_certificate)); } /* private key */ if (!priv->account->tlsPrivateKey().isEmpty()) { gtk_file_chooser_set_filename( GTK_FILE_CHOOSER(priv->filechooserbutton_private_key), priv->account->tlsPrivateKey().toUtf8().constData() ); } else { /* make sure nothing is selected */ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(priv->filechooserbutton_private_key)); } /* password */ check_tlspassword_valid(self); if (priv->user_cert && priv->user_cert->requirePrivateKeyPassword()) { gtk_entry_set_text( GTK_ENTRY(priv->entry_password), priv->account->tlsPassword().toUtf8().constData() ); gtk_widget_set_sensitive(priv->entry_password, TRUE); gtk_widget_set_sensitive(priv->label_private_key_password, TRUE); } else { /* private key not chosen, or password not required, so disactivate the entry */ gtk_widget_set_sensitive(priv->entry_password, FALSE); gtk_widget_set_sensitive(priv->label_private_key_password, FALSE); } /* outgoing TLS server */ gtk_entry_set_text(GTK_ENTRY(priv->entry_tls_server_name), priv->account->tlsServerName().toUtf8().constData()); /* TLS nego timeout */ gtk_adjustment_set_value(GTK_ADJUSTMENT(priv->adjustment_tls_timeout), priv->account->tlsNegotiationTimeoutSec()); /* cipher default or custom */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->radiobutton_use_default_ciphers), priv->account->cipherModel()->useDefault()); /* server certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_verify_certs_server), priv->account->isTlsVerifyServer()); /* client certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_verify_certs_client), priv->account->isTlsVerifyClient()); /* incoming certs */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->checkbutton_require_incoming_tls_certs), priv->account->isTlsRequireClientCertificate()); } ); }
static void delegate_unselect_all (GtkFileChooser *chooser) { gtk_file_chooser_unselect_all (get_delegate (chooser)); }
static void unselect_all_clicked_cb (GtkWidget *button, gpointer user_data) { gtk_file_chooser_unselect_all (user_data); }
void XeTeXDialog::on_button_font_mapping_clear_clicked (GtkButton *button, gpointer user_data) { GtkFileChooser * filechooser = GTK_FILE_CHOOSER (user_data); gtk_file_chooser_unselect_all (filechooser); }
/*! \brief General purpose handler to hide/show Sensor calibrate window \param widget is a pointer to the widget clicked \param data is unused \returns TRUE */ G_MODULE_EXPORT gboolean show_ms2_therm_table_generator_window(GtkWidget *widget, gpointer data) { static GtkWidget *window = NULL; static GtkWidget *chooser = NULL; GtkWidget *item = NULL; GladeXML *main_xml = NULL; GladeXML *xml = NULL; Firmware_Details *firmware = NULL; ENTER(); firmware = (Firmware_Details *)DATA_GET(global_data,"firmware"); main_xml = (GladeXML *)DATA_GET(global_data,"main_xml"); g_return_val_if_fail(firmware,FALSE); g_return_val_if_fail(main_xml,FALSE); if (DATA_GET(global_data,"leaving")) { EXIT(); return TRUE; } if (!GTK_IS_WIDGET(window)) { xml = glade_xml_new(main_xml->filename,"table_generator_window",NULL); window = glade_xml_get_widget(xml,"table_generator_window"); glade_xml_signal_autoconnect(xml); /* Default to params not a file */ chooser = glade_xml_get_widget(xml,"import_filechooser_button"); register_widget_f("import_filechooser_button",chooser); item = glade_xml_get_widget(xml,"use_params_rbutton"); register_widget_f("use_params_rbutton",item); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item),TRUE); g_signal_emit_by_name(item,"toggled",NULL); item = glade_xml_get_widget(xml,"sensor_combo"); gtk_combo_box_set_active(GTK_COMBO_BOX(item),0); register_widget_f("thermister_sensor_combo",item); item = glade_xml_get_widget(xml,"temp_label"); register_widget_f("temp_label",item); if (firmware->capabilities & PIS) gtk_widget_destroy(glade_xml_get_widget(xml,"bias_resistor_table")); else { item = glade_xml_get_widget(xml,"bias_entry"); register_widget_f("bias_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("0"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("100000"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); } item = glade_xml_get_widget(xml,"temp1_entry"); register_widget_f("temp1_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("-40"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("300"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"temp2_entry"); register_widget_f("temp2_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("-40"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("300"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"temp3_entry"); register_widget_f("temp3_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("-40"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("300"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"resistance1_entry"); register_widget_f("resistance1_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("0"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("500000"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"resistance2_entry"); register_widget_f("resistance2_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("0"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("500000"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"resistance3_entry"); register_widget_f("resistance3_entry",item); OBJ_SET_FULL(item,"raw_lower",g_strdup("0"),g_free); OBJ_SET_FULL(item,"raw_upper",g_strdup("500000"),g_free); OBJ_SET(item,"precision",GINT_TO_POINTER(1)); item = glade_xml_get_widget(xml,"celsius_rbutton"); OBJ_SET_FULL(item,"temp_label",g_strdup("Temperature(\302\260 C)"),g_free); register_widget_f("thermister_celsius_rbutton",item); item = glade_xml_get_widget(xml,"fahrenheit_rbutton"); OBJ_SET_FULL(item,"temp_label",g_strdup("Temperature(\302\260 F)"),g_free); register_widget_f("thermister_fahrenheit_rbutton",item); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(item),TRUE); g_signal_emit_by_name(item,"toggled",NULL); item = glade_xml_get_widget(xml,"kelvin_rbutton"); OBJ_SET_FULL(item,"temp_label",g_strdup("Temperature(\302\260 K)"),g_free); register_widget_f("thermister_kelvin_rbutton",item); gtk_window_set_transient_for(GTK_WINDOW(window),GTK_WINDOW(lookup_widget_f("main_window"))); gtk_widget_show(GTK_WIDGET(window)); EXIT(); return TRUE; } #if GTK_MINOR_VERSION >= 18 if (gtk_widget_get_visible(GTK_WIDGET(window))) #else if (GTK_WIDGET_VISIBLE(GTK_WIDGET(window))) #endif gtk_widget_hide(GTK_WIDGET(window)); else { gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(chooser)); gtk_widget_show(GTK_WIDGET(window)); } EXIT(); return TRUE; }
void GtkFileChooserDialog_::unselect_all() { gtk_file_chooser_unselect_all (GTK_FILE_CHOOSER(instance)); }
char * gui_get_image_save_info (GtkWindow *toplevel, GSList *supported_formats, GOImageFormat *ret_format, double *resolution) { GOImageFormat format; GOImageFormatInfo const *format_info; GtkComboBox *format_combo = NULL; GtkFileChooser *fsel = gui_image_chooser_new (TRUE); GtkWidget *expander = NULL; GtkWidget *resolution_spin = NULL; GtkWidget *resolution_table; GladeXML *gui; SaveInfoState *state; const char *key = "gui_get_image_save_info"; char *uri = NULL; state = g_object_get_data (G_OBJECT (toplevel), key); if (state == NULL) { state = g_new (SaveInfoState, 1); g_return_val_if_fail (state != NULL, NULL); state->uri = NULL; state->resolution = 150.0; state->is_expanded = FALSE; state->format = GO_IMAGE_FORMAT_SVG; g_object_set_data_full (G_OBJECT (toplevel), key, state, (GDestroyNotify) save_info_state_free); } g_object_set (G_OBJECT (fsel), "title", _("Save as"), NULL); gui = go_libglade_new ("go-image-save-dialog-extra.glade", "image_save_dialog_extra", GETTEXT_PACKAGE, NULL); if (gui != NULL) { GtkWidget *widget; /* Format selection UI */ if (supported_formats != NULL && ret_format != NULL) { int i; GSList *l; format_combo = GTK_COMBO_BOX (glade_xml_get_widget (gui, "format_combo")); for (l = supported_formats, i = 0; l != NULL; l = l->next, i++) { format = GPOINTER_TO_UINT (l->data); format_info = go_image_get_format_info (format); gtk_combo_box_append_text (format_combo, _(format_info->desc)); if (format == state->format) gtk_combo_box_set_active (format_combo, i); } if (gtk_combo_box_get_active (format_combo) < 0) gtk_combo_box_set_active (format_combo, 0); } else { widget = glade_xml_get_widget (gui, "file_type_box"); gtk_widget_hide (widget); } /* Export setting expander */ expander = glade_xml_get_widget (gui, "export_expander"); if (resolution != NULL) { gtk_expander_set_expanded (GTK_EXPANDER (expander), state->is_expanded); resolution_spin = glade_xml_get_widget (gui, "resolution_spin"); gtk_spin_button_set_value (GTK_SPIN_BUTTON (resolution_spin), state->resolution); } else gtk_widget_hide (expander); if (resolution != NULL && supported_formats != NULL && ret_format != NULL) { widget = glade_xml_get_widget (gui, "image_save_dialog_extra"); gtk_file_chooser_set_extra_widget (fsel, widget); resolution_table = glade_xml_get_widget (gui, "resolution_table"); cb_format_combo_changed (format_combo, resolution_table); g_signal_connect (GTK_WIDGET (format_combo), "changed", G_CALLBACK (cb_format_combo_changed), resolution_table); } g_object_unref (G_OBJECT (gui)); } if (state->uri != NULL) { gtk_file_chooser_set_uri (fsel, state->uri); gtk_file_chooser_unselect_all (fsel); } /* Show file selector */ loop: if (!go_gtk_file_sel_dialog (toplevel, GTK_WIDGET (fsel))) goto out; uri = gtk_file_chooser_get_uri (fsel); if (format_combo) { char *new_uri = NULL; format = GPOINTER_TO_UINT (g_slist_nth_data (supported_formats, gtk_combo_box_get_active (format_combo))); format_info = go_image_get_format_info (format); if (!go_url_check_extension (uri, format_info->ext, &new_uri) && !go_gtk_query_yes_no (GTK_WINDOW (fsel), TRUE, _("The given file extension does not match the" " chosen file type. Do you want to use this name" " anyway?"))) { g_free (new_uri); g_free (uri); uri = NULL; goto out; } else { g_free (uri); uri = new_uri; } *ret_format = format; } if (!go_gtk_url_is_writeable (GTK_WINDOW (fsel), uri, TRUE)) { g_free (uri); uri = NULL; goto loop; } out: if (uri != NULL) { g_free (state->uri); state->uri = g_strdup (uri); state->format = *ret_format; if (resolution != NULL) { state->is_expanded = gtk_expander_get_expanded (GTK_EXPANDER (expander)); *resolution = gtk_spin_button_get_value (GTK_SPIN_BUTTON (resolution_spin)); state->resolution = *resolution; } } gtk_widget_destroy (GTK_WIDGET (fsel)); return uri; }
static void create_file_save_as_dialog(const gchar *extension, ExportFunc func, gboolean show_zoom_level_checkbox) { GtkWidget *dialog, *vbox; GeanyDocument *doc; ExportInfo *exi; g_return_if_fail(extension != NULL); doc = document_get_current(); g_return_if_fail(doc != NULL); exi = g_new(ExportInfo, 1); exi->doc = doc; exi->export_func = func; exi->have_zoom_level_checkbox = FALSE; dialog = gtk_file_chooser_dialog_new(_("Export File"), GTK_WINDOW(geany->main_widgets->window), GTK_FILE_CHOOSER_ACTION_SAVE, NULL, NULL); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE); gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE); gtk_window_set_type_hint(GTK_WINDOW(dialog), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_widget_set_name(dialog, "GeanyExportDialog"); gtk_dialog_add_buttons(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); /* file chooser extra widget */ vbox = gtk_vbox_new(FALSE, 0); gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(dialog), vbox); { GtkWidget *check_line_numbers; check_line_numbers = gtk_check_button_new_with_mnemonic(_("_Insert line numbers")); gtk_widget_set_tooltip_text(check_line_numbers, _("Insert line numbers before each line in the exported document")); gtk_box_pack_start(GTK_BOX(vbox), check_line_numbers, FALSE, FALSE, 0); gtk_widget_show_all(vbox); ui_hookup_widget(dialog, check_line_numbers, "check_line_numbers"); } if (show_zoom_level_checkbox) { GtkWidget *check_zoom_level; check_zoom_level = gtk_check_button_new_with_mnemonic(_("_Use current zoom level")); gtk_widget_set_tooltip_text(check_zoom_level, _("Renders the font size of the document together with the current zoom level")); gtk_box_pack_start(GTK_BOX(vbox), check_zoom_level, FALSE, FALSE, 0); gtk_widget_show_all(vbox); ui_hookup_widget(dialog, check_zoom_level, "check_zoom_level"); exi->have_zoom_level_checkbox = TRUE; } g_signal_connect(dialog, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); g_signal_connect(dialog, "response", G_CALLBACK(on_file_save_dialog_response), exi); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(geany->main_widgets->window)); /* if the current document has a filename we use it as the default. */ gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog)); if (doc->file_name != NULL) { gchar *base_name = g_path_get_basename(doc->file_name); gchar *file_name; gchar *locale_filename; gchar *locale_dirname; const gchar *suffix = ""; if (g_str_has_suffix(doc->file_name, extension)) suffix = "_export"; file_name = g_strconcat(base_name, suffix, extension, NULL); locale_filename = utils_get_locale_from_utf8(doc->file_name); locale_dirname = g_path_get_dirname(locale_filename); /* set the current name to base_name.html which probably doesn't exist yet so * gtk_file_chooser_set_filename() can't be used and we need * gtk_file_chooser_set_current_folder() additionally */ gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_dirname); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), file_name); g_free(locale_dirname); g_free(locale_filename); g_free(file_name); g_free(base_name); } else { const gchar *default_open_path = geany->prefs->default_open_path; gchar *fname = g_strconcat(GEANY_STRING_UNTITLED, extension, NULL); gtk_file_chooser_unselect_all(GTK_FILE_CHOOSER(dialog)); gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fname); /* use default startup directory(if set) if no files are open */ if (NZV(default_open_path) && g_path_is_absolute(default_open_path)) { gchar *locale_path = utils_get_locale_from_utf8(default_open_path); gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), locale_path); g_free(locale_path); } g_free(fname); } gtk_dialog_run(GTK_DIALOG(dialog)); }