static gpointer gw_installprogresswindow_install_thread (gpointer data) { //Declarations GwInstallProgressWindow *window; GwInstallProgressWindowPrivate *priv; GwApplication *application; GwDictionaryList *dictionarylist; GList *link; LwDictionary *dictionary; GError *error; gulong signalid; GCancellable *cancellable; //Initializations window = GW_INSTALLPROGRESSWINDOW (data); if (window == NULL) return NULL; priv = window->priv; application = gw_window_get_application (GW_WINDOW (window)); dictionarylist = gw_application_get_installable_dictionarylist (application); cancellable = priv->cancellable; error = NULL; link = lw_dictionarylist_get_list (LW_DICTIONARYLIST (dictionarylist)); //Do the installation g_timeout_add (100, gw_installprogresswindow_update_ui_timeout, window); while (link != NULL && error == NULL) { dictionary = LW_DICTIONARY (link->data); if (dictionary != NULL && lw_dictionary_is_selected (dictionary)) { g_mutex_lock (&priv->mutex); priv->dictionary = dictionary; g_mutex_unlock (&priv->mutex); signalid = g_signal_connect (dictionary, "progress-changed", G_CALLBACK (gw_installprogresswindow_update_dictionary_cb), window); lw_dictionary_install (dictionary, cancellable, &error); if (g_signal_handler_is_connected (dictionary, signalid)) g_signal_handler_disconnect (dictionary, signalid); } link = link->next; } gw_application_set_error (application, error); error = NULL; g_mutex_lock (&priv->mutex); //This will clue the progress window to close itself priv->dictionary = NULL; g_mutex_unlock (&priv->mutex); return NULL; }
LwDictionary* lw_dictionary_installer_new (GType type) { g_return_val_if_fail (g_type_is_a (type, LW_TYPE_DICTIONARY) != FALSE, NULL); //Declarations LwDictionary *dictionary; //Initializations dictionary = LW_DICTIONARY (g_object_new (type, NULL)); return dictionary; }
//! //! @brief Prints out the yet uninstalled available dictionaries. //! void w_console_print_installable_dictionaries (WApplication *application) { printf(gettext("Installable dictionaries are:\n")); //Declarations gint i; gint j; GList *iter; LwDictionaryList *dictionarylist; LwDictionary* dictionary; const gchar* filename; //Initializations i = 0; dictionarylist = w_application_get_installable_dictionarylist (application); iter = lw_dictionarylist_get_list (dictionarylist); while (iter != NULL) { dictionary = LW_DICTIONARY (iter->data); if (lw_dictionary_installer_is_valid (dictionary)) { filename = lw_dictionary_get_filename (dictionary); printf(" %s", filename); for (j = strlen(filename); j < 20; j++) printf(" "); printf("(AKA: %s Dictionary)\n", lw_dictionary_get_name (dictionary)); i++; } iter = iter->next; } if (i == 0) { printf(" %s\n", gettext("none")); } }
//! //! @brief Not yet written //! void w_console_print_available_dictionaries (WApplication *application) { //Declarations gint i; gint j; LwDictionaryList *dictionarylist; LwDictionary* dictionary; GList *link; const gchar *filename; //Initializations i = 0; j = 0; dictionarylist = w_application_get_installed_dictionarylist (application); link = lw_dictionarylist_get_list (dictionarylist); printf(gettext("Available dictionaries are:\n")); while (link != NULL) { dictionary = LW_DICTIONARY (link->data); filename = lw_dictionary_get_filename (dictionary); printf(" %s", filename); for (j = strlen(filename); j < 20; j++) printf(" "); printf("(AKA: %s Dictionary)\n", lw_dictionary_get_name (dictionary)); i++; link = link->next; } if (i == 0) { printf(" %s\n", gettext("none")); } }