GtkListStore* gw_addvocabularywindow_get_wordstore (GwAddVocabularyWindow *window) { //Declarations GwApplication *application; GtkListStore *wordstore; GtkListStore *liststore; const gchar *name; //Initializations application = gw_window_get_application (GW_WINDOW (window)); liststore = gw_application_get_vocabularyliststore (application); name = gw_addvocabularywindow_get_list (window); wordstore = gw_vocabularyliststore_get_wordstore_by_name (GW_VOCABULARYLISTSTORE (liststore), name); return wordstore; }
static void gw_application_initialize_menumodel_links (GwApplication *application) { //Sanity checks g_return_if_fail (application != NULL); //Declarations GwVocabularyListStore *store; GMenuModel *menumodel; GMenuModel *link; //Initializations menumodel = gtk_application_get_app_menu (GTK_APPLICATION (application)); g_return_if_fail (menumodel != NULL); store = GW_VOCABULARYLISTSTORE (gw_application_get_vocabularyliststore (application)); link = gw_vocabularyliststore_get_menumodel (store); gw_menumodel_set_links (menumodel, "vocabulary-list-link", gettext ("Vocabulary"), G_MENU_LINK_SECTION, link); }
static void gw_addvocabularywindow_init_combobox (GwAddVocabularyWindow *window) { GwAddVocabularyWindowPrivate *priv; GwAddVocabularyWindowClass *klass; GwApplication *application; GtkListStore *store; GtkTreeModel *model; priv = window->priv; klass = GW_ADDVOCABULARYWINDOW_CLASS (G_OBJECT_GET_CLASS (window)); application = gw_window_get_application (GW_WINDOW (window)); store = gw_application_get_vocabularyliststore (application); model = GTK_TREE_MODEL (store); //Initialize the combobox gtk_combo_box_set_model (priv->vocabulary_list_combobox, model); //Remove the default entry since it doesn't seem to be editable for some reason priv->list_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->vocabulary_list_combobox))); gtk_widget_destroy (GTK_WIDGET (priv->list_entry)); //Add our entry priv->list_entry = GTK_ENTRY (gtk_entry_new ()); gtk_entry_set_activates_default (priv->list_entry, TRUE); g_signal_connect (G_OBJECT (priv->list_entry), "changed", G_CALLBACK (gw_addvocabularywindow_list_changed_cb), window); gtk_widget_show (GTK_WIDGET (priv->list_entry)); gtk_combo_box_set_entry_text_column (priv->vocabulary_list_combobox, GW_VOCABULARYLISTSTORE_COLUMN_NAME); gtk_container_add (GTK_CONTAINER (priv->vocabulary_list_combobox), GTK_WIDGET (priv->list_entry)); //Set the correct initial selection if (klass->last_selected_list_name != NULL) { gtk_entry_set_text (priv->list_entry, klass->last_selected_list_name); } else { gtk_combo_box_set_active (priv->vocabulary_list_combobox, 0); } gtk_editable_select_region (GTK_EDITABLE (priv->list_entry), 0, 0); }
void gw_application_quit (GwApplication *application) { gw_application_block_searches (application); GList *link; GtkListStore *liststore; gboolean has_changes; gboolean should_close; liststore = gw_application_get_vocabularyliststore (application); has_changes = gw_vocabularyliststore_has_changes (GW_VOCABULARYLISTSTORE (liststore)); should_close = TRUE; if (has_changes) { link = gtk_application_get_windows (GTK_APPLICATION (application)); while (link != NULL && GW_IS_VOCABULARYWINDOW (link->data) == FALSE) link = link->next; if (link != NULL) { should_close = gw_vocabularywindow_show_save_dialog (GW_VOCABULARYWINDOW (link->data)); } } if (should_close) { link = gtk_application_get_windows (GTK_APPLICATION (application)); while (link != NULL) { gtk_widget_destroy (GTK_WIDGET (link->data)); link = gtk_application_get_windows (GTK_APPLICATION (application)); } } gw_application_unblock_searches (application); }