Exemplo n.º 1
0
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;
}
Exemplo n.º 2
0
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);
}
Exemplo n.º 3
0
GtkListStore*
gw_application_get_vocabularyliststore (GwApplication *application)
{
  GwApplicationPrivate *priv;
  LwPreferences *preferences;
  gpointer* pointer;

  priv = application->priv;

  if (priv->vocabularyliststore == NULL)
  {
    preferences = gw_application_get_preferences (application);
    priv->vocabularyliststore = gw_vocabularyliststore_new ();
    pointer = (gpointer*) &(priv->vocabularyliststore);
    g_object_add_weak_pointer (G_OBJECT (priv->vocabularyliststore), pointer);
    gw_vocabularyliststore_load_list_order (GW_VOCABULARYLISTSTORE (priv->vocabularyliststore), preferences);
  }

  return priv->vocabularyliststore;
}
Exemplo n.º 4
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);
}