Skip to content

Commit

Permalink
Update plugins to use EomWindowActivatable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
fxri authored and raveit65 committed Jul 11, 2018
1 parent 026b114 commit 9b79e09
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 46 deletions.
29 changes: 15 additions & 14 deletions plugins/fullscreen/eom-fullscreen-plugin.c
Expand Up @@ -10,19 +10,20 @@

#include <eom-debug.h>
#include <eom-window.h>
#include <eom-window-activatable.h>

static void peas_activatable_iface_init (PeasActivatableInterface *iface);
static void eom_window_activatable_iface_init (EomWindowActivatableInterface *iface);

G_DEFINE_DYNAMIC_TYPE_EXTENDED (EomFullscreenPlugin,
eom_fullscreen_plugin,
PEAS_TYPE_EXTENSION_BASE,
0,
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
peas_activatable_iface_init))
G_IMPLEMENT_INTERFACE_DYNAMIC (EOM_TYPE_WINDOW_ACTIVATABLE,
eom_window_activatable_iface_init))

enum {
PROP_0,
PROP_OBJECT
PROP_WINDOW
};

static gboolean
Expand Down Expand Up @@ -59,8 +60,8 @@ eom_fullscreen_plugin_set_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
plugin->window = GTK_WIDGET (g_value_dup_object (value));
case PROP_WINDOW:
plugin->window = EOM_WINDOW (g_value_dup_object (value));
break;

default:
Expand All @@ -79,7 +80,7 @@ eom_fullscreen_plugin_get_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
case PROP_WINDOW:
g_value_set_object (value, plugin->window);
break;

Expand Down Expand Up @@ -111,10 +112,10 @@ eom_fullscreen_plugin_dispose (GObject *object)
}

static void
eom_fullscreen_plugin_activate (PeasActivatable *activatable)
eom_fullscreen_plugin_activate (EomWindowActivatable *activatable)
{
EomFullscreenPlugin *plugin = EOM_FULLSCREEN_PLUGIN (activatable);
GtkWidget *view = eom_window_get_view (EOM_WINDOW (plugin->window));
GtkWidget *view = eom_window_get_view (plugin->window);

eom_debug (DEBUG_PLUGINS);

Expand All @@ -125,10 +126,10 @@ eom_fullscreen_plugin_activate (PeasActivatable *activatable)
}

static void
eom_fullscreen_plugin_deactivate (PeasActivatable *activatable)
eom_fullscreen_plugin_deactivate (EomWindowActivatable *activatable)
{
EomFullscreenPlugin *plugin = EOM_FULLSCREEN_PLUGIN (activatable);
GtkWidget *view = eom_window_get_view (EOM_WINDOW (plugin->window));
GtkWidget *view = eom_window_get_view (plugin->window);

g_signal_handler_disconnect (view, plugin->signal_id);
}
Expand All @@ -142,7 +143,7 @@ eom_fullscreen_plugin_class_init (EomFullscreenPluginClass *klass)
object_class->set_property = eom_fullscreen_plugin_set_property;
object_class->get_property = eom_fullscreen_plugin_get_property;

g_object_class_override_property (object_class, PROP_OBJECT, "object");
g_object_class_override_property (object_class, PROP_WINDOW, "window");
}

static void
Expand All @@ -152,7 +153,7 @@ eom_fullscreen_plugin_class_finalize (EomFullscreenPluginClass *klass)
}

static void
peas_activatable_iface_init (PeasActivatableInterface *iface)
eom_window_activatable_iface_init (EomWindowActivatableInterface *iface)
{
iface->activate = eom_fullscreen_plugin_activate;
iface->deactivate = eom_fullscreen_plugin_deactivate;
Expand All @@ -163,6 +164,6 @@ peas_register_types (PeasObjectModule *module)
{
eom_fullscreen_plugin_register_type (G_TYPE_MODULE (module));
peas_object_module_register_extension_type (module,
PEAS_TYPE_ACTIVATABLE,
EOM_TYPE_WINDOW_ACTIVATABLE,
EOM_TYPE_FULLSCREEN_PLUGIN);
}
4 changes: 3 additions & 1 deletion plugins/fullscreen/eom-fullscreen-plugin.h
Expand Up @@ -7,6 +7,8 @@
#include <libpeas/peas-extension-base.h>
#include <libpeas/peas-object-module.h>

#include <eom-window.h>

G_BEGIN_DECLS

/*
Expand Down Expand Up @@ -36,7 +38,7 @@ typedef struct _EomFullscreenPlugin EomFullscreenPlugin;
struct _EomFullscreenPlugin {
PeasExtensionBase parent_instance;

GtkWidget *window;
EomWindow *window;
gulong signal_id;
};

Expand Down
29 changes: 15 additions & 14 deletions plugins/reload/eom-reload-plugin.c
Expand Up @@ -10,19 +10,20 @@

#include <eom-debug.h>
#include <eom-window.h>
#include <eom-window-activatable.h>

static void peas_activatable_iface_init (PeasActivatableInterface *iface);
static void eom_window_activatable_iface_init (EomWindowActivatableInterface *iface);

G_DEFINE_DYNAMIC_TYPE_EXTENDED (EomReloadPlugin,
eom_reload_plugin,
PEAS_TYPE_EXTENSION_BASE,
0,
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
peas_activatable_iface_init))
G_IMPLEMENT_INTERFACE_DYNAMIC (EOM_TYPE_WINDOW_ACTIVATABLE,
eom_window_activatable_iface_init))

enum {
PROP_0,
PROP_OBJECT
PROP_WINDOW
};

static void
Expand Down Expand Up @@ -54,8 +55,8 @@ eom_reload_plugin_set_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
plugin->window = GTK_WIDGET (g_value_dup_object (value));
case PROP_WINDOW:
plugin->window = EOM_WINDOW (g_value_dup_object (value));
break;

default:
Expand All @@ -74,7 +75,7 @@ eom_reload_plugin_get_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
case PROP_WINDOW:
g_value_set_object (value, plugin->window);
break;

Expand Down Expand Up @@ -106,14 +107,14 @@ eom_reload_plugin_dispose (GObject *object)
}

static void
eom_reload_plugin_activate (PeasActivatable *activatable)
eom_reload_plugin_activate (EomWindowActivatable *activatable)
{
EomReloadPlugin *plugin = EOM_RELOAD_PLUGIN (activatable);
GtkUIManager *manager;

eom_debug (DEBUG_PLUGINS);

manager = eom_window_get_ui_manager (EOM_WINDOW (plugin->window));
manager = eom_window_get_ui_manager (plugin->window);

plugin->ui_action_group = gtk_action_group_new ("EomReloadPluginActions");

Expand All @@ -129,14 +130,14 @@ eom_reload_plugin_activate (PeasActivatable *activatable)
}

static void
eom_reload_plugin_deactivate (PeasActivatable *activatable)
eom_reload_plugin_deactivate (EomWindowActivatable *activatable)
{
EomReloadPlugin *plugin = EOM_RELOAD_PLUGIN (activatable);
GtkUIManager *manager;

eom_debug (DEBUG_PLUGINS);

manager = eom_window_get_ui_manager (EOM_WINDOW (plugin->window));
manager = eom_window_get_ui_manager (plugin->window);

gtk_ui_manager_remove_ui (manager, plugin->ui_id);

Expand All @@ -154,7 +155,7 @@ eom_reload_plugin_class_init (EomReloadPluginClass *klass)
object_class->set_property = eom_reload_plugin_set_property;
object_class->get_property = eom_reload_plugin_get_property;

g_object_class_override_property (object_class, PROP_OBJECT, "object");
g_object_class_override_property (object_class, PROP_WINDOW, "window");
}

static void
Expand All @@ -164,7 +165,7 @@ eom_reload_plugin_class_finalize (EomReloadPluginClass *klass)
}

static void
peas_activatable_iface_init (PeasActivatableInterface *iface)
eom_window_activatable_iface_init (EomWindowActivatableInterface *iface)
{
iface->activate = eom_reload_plugin_activate;
iface->deactivate = eom_reload_plugin_deactivate;
Expand All @@ -175,6 +176,6 @@ peas_register_types (PeasObjectModule *module)
{
eom_reload_plugin_register_type (G_TYPE_MODULE (module));
peas_object_module_register_extension_type (module,
PEAS_TYPE_ACTIVATABLE,
EOM_TYPE_WINDOW_ACTIVATABLE,
EOM_TYPE_RELOAD_PLUGIN);
}
4 changes: 3 additions & 1 deletion plugins/reload/eom-reload-plugin.h
Expand Up @@ -7,6 +7,8 @@
#include <libpeas/peas-extension-base.h>
#include <libpeas/peas-object-module.h>

#include <eom-window.h>

G_BEGIN_DECLS

/*
Expand Down Expand Up @@ -36,7 +38,7 @@ typedef struct _EomReloadPlugin EomReloadPlugin;
struct _EomReloadPlugin {
PeasExtensionBase parent_instance;

GtkWidget *window;
EomWindow *window;
GtkActionGroup *ui_action_group;
guint ui_id;
};
Expand Down
31 changes: 16 additions & 15 deletions plugins/statusbar-date/eom-statusbar-date-plugin.c
Expand Up @@ -32,21 +32,22 @@
#include <eom-debug.h>
#include <eom-image.h>
#include <eom-thumb-view.h>
#include <eom-window.h>
#include <eom-exif-util.h>
#include <eom-window.h>
#include <eom-window-activatable.h>

static void peas_activatable_iface_init (PeasActivatableInterface *iface);
static void eom_window_activatable_iface_init (EomWindowActivatableInterface *iface);

G_DEFINE_DYNAMIC_TYPE_EXTENDED (EomStatusbarDatePlugin,
eom_statusbar_date_plugin,
PEAS_TYPE_EXTENSION_BASE,
0,
G_IMPLEMENT_INTERFACE_DYNAMIC (PEAS_TYPE_ACTIVATABLE,
peas_activatable_iface_init))
G_IMPLEMENT_INTERFACE_DYNAMIC (EOM_TYPE_WINDOW_ACTIVATABLE,
eom_window_activatable_iface_init))

enum {
PROP_0,
PROP_OBJECT
PROP_WINDOW
};

static void
Expand Down Expand Up @@ -112,8 +113,8 @@ eom_statusbar_date_plugin_set_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
plugin->window = GTK_WIDGET (g_value_dup_object (value));
case PROP_WINDOW:
plugin->window = EOM_WINDOW (g_value_dup_object (value));
break;

default:
Expand All @@ -132,7 +133,7 @@ eom_statusbar_date_plugin_get_property (GObject *object,

switch (prop_id)
{
case PROP_OBJECT:
case PROP_WINDOW:
g_value_set_object (value, plugin->window);
break;

Expand Down Expand Up @@ -164,10 +165,10 @@ eom_statusbar_date_plugin_dispose (GObject *object)
}

static void
eom_statusbar_date_plugin_activate (PeasActivatable *activatable)
eom_statusbar_date_plugin_activate (EomWindowActivatable *activatable)
{
EomStatusbarDatePlugin *plugin = EOM_STATUSBAR_DATE_PLUGIN (activatable);
EomWindow *window = EOM_WINDOW (plugin->window);
EomWindow *window = plugin->window;
GtkWidget *statusbar = eom_window_get_statusbar (window);
GtkWidget *thumbview = eom_window_get_thumb_view (window);

Expand All @@ -187,10 +188,10 @@ eom_statusbar_date_plugin_activate (PeasActivatable *activatable)
}

static void
eom_statusbar_date_plugin_deactivate (PeasActivatable *activatable)
eom_statusbar_date_plugin_deactivate (EomWindowActivatable *activatable)
{
EomStatusbarDatePlugin *plugin = EOM_STATUSBAR_DATE_PLUGIN (activatable);
EomWindow *window = EOM_WINDOW (plugin->window);
EomWindow *window = plugin->window;
GtkWidget *statusbar = eom_window_get_statusbar (window);
GtkWidget *view = eom_window_get_thumb_view (window);

Expand All @@ -208,7 +209,7 @@ eom_statusbar_date_plugin_class_init (EomStatusbarDatePluginClass *klass)
object_class->set_property = eom_statusbar_date_plugin_set_property;
object_class->get_property = eom_statusbar_date_plugin_get_property;

g_object_class_override_property (object_class, PROP_OBJECT, "object");
g_object_class_override_property (object_class, PROP_WINDOW, "window");
}

static void
Expand All @@ -218,7 +219,7 @@ eom_statusbar_date_plugin_class_finalize (EomStatusbarDatePluginClass *klass)
}

static void
peas_activatable_iface_init (PeasActivatableInterface *iface)
eom_window_activatable_iface_init (EomWindowActivatableInterface *iface)
{
iface->activate = eom_statusbar_date_plugin_activate;
iface->deactivate = eom_statusbar_date_plugin_deactivate;
Expand All @@ -229,6 +230,6 @@ peas_register_types (PeasObjectModule *module)
{
eom_statusbar_date_plugin_register_type (G_TYPE_MODULE (module));
peas_object_module_register_extension_type (module,
PEAS_TYPE_ACTIVATABLE,
EOM_TYPE_WINDOW_ACTIVATABLE,
EOM_TYPE_STATUSBAR_DATE_PLUGIN);
}
4 changes: 3 additions & 1 deletion plugins/statusbar-date/eom-statusbar-date-plugin.h
Expand Up @@ -28,6 +28,8 @@
#include <libpeas/peas-extension-base.h>
#include <libpeas/peas-object-module.h>

#include <eom-window.h>

G_BEGIN_DECLS

/*
Expand Down Expand Up @@ -57,7 +59,7 @@ typedef struct _EomStatusbarDatePlugin EomStatusbarDatePlugin;
struct _EomStatusbarDatePlugin {
PeasExtensionBase parent_instance;

GtkWidget *window;
EomWindow *window;
GtkWidget *statusbar_date;
gulong signal_id;
};
Expand Down

0 comments on commit 9b79e09

Please sign in to comment.