static void gdict_source_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GdictSource *source = GDICT_SOURCE (object); GdictSourcePrivate *priv = source->priv; switch (prop_id) { case PROP_FILENAME: g_value_set_string (value, priv->filename); break; case PROP_NAME: g_value_set_string (value, priv->name); break; case PROP_DESCRIPTION: g_value_set_string (value, priv->description); break; case PROP_EDITABLE: g_value_set_boolean (value, priv->editable); break; case PROP_DATABASE: g_value_set_string (value, priv->database); break; case PROP_STRATEGY: g_value_set_string (value, priv->strategy); break; case PROP_TRANSPORT: g_value_set_enum (value, priv->transport); break; case PROP_CONTEXT: g_value_set_object (value, gdict_source_peek_context (source)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gdict_look_up_word_and_quit (GdictApp *app) { GdictSource *source; GdictContext *context; GSList *l; if ((!app->lookup_words) || (!app->match_words)) { g_print (_("See mate-dictionary --help for usage\n")); gdict_cleanup (); exit (1); } if (app->source_name) source = gdict_source_loader_get_source (app->loader, app->source_name); else source = gdict_source_loader_get_source (app->loader, GDICT_DEFAULT_SOURCE_NAME); if (!source) { g_warning (_("Unable to find a suitable dictionary source")); gdict_cleanup (); exit (1); } /* we'll just use this one context, so we can destroy it along with * the source that contains it */ context = gdict_source_peek_context (source); g_assert (GDICT_IS_CONTEXT (context)); g_signal_connect (context, "definition-found", G_CALLBACK (definition_found_cb), app); g_signal_connect (context, "error", G_CALLBACK (error_cb), app); g_signal_connect (context, "lookup-end", G_CALLBACK (lookup_end_cb), app); app->remaining_words = 0; for (l = app->lookup_words; l != NULL; l = l->next) { gchar *word = l->data; GError *err = NULL; app->remaining_words += 1; gdict_context_define_word (context, app->database, word, &err); if (err) { g_warning (_("Error while looking up the definition of \"%s\":\n%s"), word, err->message); g_error_free (err); } } gtk_main (); g_object_unref (source); gdict_cleanup (); exit (0); }