static gboolean eom_plugin_engine_activate_plugin_real (EomPluginInfo *info) { gboolean res = TRUE; /* Plugin is not available, don't try to activate/load it */ if (!info->available) { return FALSE; } if (info->plugin == NULL) res = load_plugin_module (info); if (res) { const GList *wins = eom_application_get_windows (EOM_APP); while (wins != NULL) { eom_plugin_activate (info->plugin, EOM_WINDOW (wins->data)); wins = g_list_next (wins); } } else { g_warning ("Error activating plugin '%s'", info->name); } return res; }
/** * eom_application_open_file_list: * @application: An #EomApplication. * @file_list: (element-type GFile): A list of #GFile<!-- -->s * @timestamp: The timestamp of the user interaction which triggered this call * (see gtk_window_present_with_time()). * @flags: A set of #EomStartupFlags influencing a new windows' state. * @error: Return location for a #GError, or NULL to ignore errors. * * Opens a list of files in a #EomWindow. If an #EomWindow displaying the first * image in the list is already open, this will be used. Otherwise, an empty * #EomWindow is used, either already existing or newly created. * * Returns: Currently always %TRUE. **/ gboolean eom_application_open_file_list (EomApplication *application, GSList *file_list, guint timestamp, EomStartupFlags flags, GError **error) { EomWindow *new_window = NULL; if (file_list != NULL) new_window = eom_application_get_file_window (application, (GFile *) file_list->data); if (new_window != NULL) { gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp); return TRUE; } new_window = eom_application_get_empty_window (application); if (new_window == NULL) { new_window = EOM_WINDOW (eom_window_new (flags)); } g_signal_connect (new_window, "prepared", G_CALLBACK (eom_application_show_window), GUINT_TO_POINTER (timestamp)); eom_window_open_file_list (new_window, file_list); return TRUE; }
static EomWindow * eom_application_get_file_window (EomApplication *application, GFile *file) { EomWindow *file_window = NULL; GList *windows; GList *l; g_return_val_if_fail (file != NULL, NULL); g_return_val_if_fail (EOM_IS_APPLICATION (application), NULL); windows = gtk_window_list_toplevels (); for (l = windows; l != NULL; l = l->next) { if (EOM_IS_WINDOW (l->data)) { EomWindow *window = EOM_WINDOW (l->data); if (!eom_window_is_empty (window)) { EomImage *image = eom_window_get_image (window); GFile *window_file; window_file = eom_image_get_file (image); if (g_file_equal (window_file, file)) { file_window = window; break; } } } } g_list_free (windows); return file_window; }
static void eom_plugin_engine_deactivate_plugin_real (EomPluginInfo *info) { const GList *wins = eom_application_get_windows (EOM_APP); while (wins != NULL) { eom_plugin_deactivate (info->plugin, EOM_WINDOW (wins->data)); wins = g_list_next (wins); } }
static void eom_statusbar_date_plugin_deactivate (PeasActivatable *activatable) { EomStatusbarDatePlugin *plugin = EOM_STATUSBAR_DATE_PLUGIN (activatable); EomWindow *window = EOM_WINDOW (plugin->window); GtkWidget *statusbar = eom_window_get_statusbar (window); GtkWidget *view = eom_window_get_thumb_view (window); g_signal_handler_disconnect (view, plugin->signal_id); gtk_container_remove (GTK_CONTAINER (statusbar), plugin->statusbar_date); }
static void eom_statusbar_date_plugin_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { EomStatusbarDatePlugin *plugin = EOM_STATUSBAR_DATE_PLUGIN (object); switch (prop_id) { case PROP_WINDOW: plugin->window = EOM_WINDOW (g_value_dup_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void eom_statusbar_date_plugin_activate (PeasActivatable *activatable) { EomStatusbarDatePlugin *plugin = EOM_STATUSBAR_DATE_PLUGIN (activatable); EomWindow *window = EOM_WINDOW (plugin->window); GtkWidget *statusbar = eom_window_get_statusbar (window); GtkWidget *thumbview = eom_window_get_thumb_view (window); eom_debug (DEBUG_PLUGINS); plugin->statusbar_date = gtk_statusbar_new (); gtk_widget_set_size_request (plugin->statusbar_date, 200, 10); gtk_widget_set_margin_top (GTK_WIDGET (plugin->statusbar_date), 0); gtk_widget_set_margin_bottom (GTK_WIDGET (plugin->statusbar_date), 0); gtk_box_pack_end (GTK_BOX (statusbar), plugin->statusbar_date, FALSE, FALSE, 0); plugin->signal_id = g_signal_connect_after (G_OBJECT (thumbview), "selection_changed", G_CALLBACK (selection_changed_cb), plugin); statusbar_set_date (GTK_STATUSBAR (plugin->statusbar_date), EOM_THUMB_VIEW (eom_window_get_thumb_view (window))); }
static EomWindow * eom_application_get_empty_window (EomApplication *application) { EomWindow *empty_window = NULL; GList *windows; GList *l; g_return_val_if_fail (EOM_IS_APPLICATION (application), NULL); windows = eom_application_get_windows (application); for (l = windows; l != NULL; l = l->next) { EomWindow *window = EOM_WINDOW (l->data); if (eom_window_is_empty (window)) { empty_window = window; break; } } g_list_free (windows); return empty_window; }