diff options
Diffstat (limited to 'plugins/fullscreen')
-rw-r--r-- | plugins/fullscreen/eom-fullscreen-plugin.c | 96 | ||||
-rw-r--r-- | plugins/fullscreen/eom-fullscreen-plugin.h | 34 |
2 files changed, 58 insertions, 72 deletions
diff --git a/plugins/fullscreen/eom-fullscreen-plugin.c b/plugins/fullscreen/eom-fullscreen-plugin.c index baec887..5f7d4c9 100644 --- a/plugins/fullscreen/eom-fullscreen-plugin.c +++ b/plugins/fullscreen/eom-fullscreen-plugin.c @@ -1,5 +1,5 @@ #ifdef HAVE_CONFIG_H -#include <config.h> + #include <config.h> #endif #include "eom-fullscreen-plugin.h" @@ -14,22 +14,24 @@ EOM_PLUGIN_REGISTER_TYPE(EomFullscreenPlugin, eom_fullscreen_plugin) -typedef struct -{ +typedef struct { gulong signal_id; } WindowData; -static gboolean -on_button_press (GtkWidget *button, GdkEventButton *event, EomWindow *window) +static gboolean on_button_press(GtkWidget* button, GdkEventButton* event, EomWindow* window) { - if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) { - EomWindowMode mode = eom_window_get_mode (window); - - if (mode == EOM_WINDOW_MODE_SLIDESHOW || - mode == EOM_WINDOW_MODE_FULLSCREEN) - eom_window_set_mode (window, EOM_WINDOW_MODE_NORMAL); + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + { + EomWindowMode mode = eom_window_get_mode(window); + + if (mode == EOM_WINDOW_MODE_SLIDESHOW || mode == EOM_WINDOW_MODE_FULLSCREEN) + { + eom_window_set_mode(window, EOM_WINDOW_MODE_NORMAL); + } else if (mode == EOM_WINDOW_MODE_NORMAL) - eom_window_set_mode (window, EOM_WINDOW_MODE_FULLSCREEN); + { + eom_window_set_mode(window, EOM_WINDOW_MODE_FULLSCREEN); + } return TRUE; } @@ -37,80 +39,60 @@ on_button_press (GtkWidget *button, GdkEventButton *event, EomWindow *window) return FALSE; } -static void -free_window_data (WindowData *data) +static void free_window_data(WindowData* data) { - g_return_if_fail (data != NULL); + g_return_if_fail(data != NULL); - eom_debug (DEBUG_PLUGINS); + eom_debug(DEBUG_PLUGINS); - g_free (data); + g_free(data); } -static void -eom_fullscreen_plugin_init (EomFullscreenPlugin *plugin) +static void eom_fullscreen_plugin_init (EomFullscreenPlugin* plugin) { - eom_debug_message (DEBUG_PLUGINS, "EomFullscreenPlugin initializing"); + eom_debug_message(DEBUG_PLUGINS, "EomFullscreenPlugin initializing"); } -static void -eom_fullscreen_plugin_finalize (GObject *object) +static void eom_fullscreen_plugin_finalize(GObject* object) { eom_debug_message (DEBUG_PLUGINS, "EomFullscreenPlugin finalizing"); - G_OBJECT_CLASS (eom_fullscreen_plugin_parent_class)->finalize (object); + G_OBJECT_CLASS(eom_fullscreen_plugin_parent_class)->finalize(object); } -static void -impl_activate (EomPlugin *plugin, - EomWindow *window) +static void impl_activate(EomPlugin* plugin, EomWindow* window) { - GtkWidget *view = eom_window_get_view (window); - WindowData *data; + GtkWidget* view = eom_window_get_view(window); + WindowData* data; - eom_debug (DEBUG_PLUGINS); + eom_debug(DEBUG_PLUGINS); - data = g_new (WindowData, 1); + data = g_new(WindowData, 1); - data->signal_id = g_signal_connect (G_OBJECT (view), - "button-press-event", - G_CALLBACK (on_button_press), - window); + data->signal_id = g_signal_connect(G_OBJECT(view), "button-press-event", G_CALLBACK(on_button_press), window); - g_object_set_data_full (G_OBJECT (window), - WINDOW_DATA_KEY, - data, - (GDestroyNotify) free_window_data); + g_object_set_data_full(G_OBJECT(window), WINDOW_DATA_KEY, data, (GDestroyNotify) free_window_data); } -static void -impl_deactivate (EomPlugin *plugin, - EomWindow *window) +static void impl_deactivate(EomPlugin* plugin, EomWindow* window) { - GtkWidget *view = eom_window_get_view (window); - WindowData *data; - - data = (WindowData *) g_object_get_data (G_OBJECT (window), - WINDOW_DATA_KEY); + GtkWidget* view = eom_window_get_view(window); + WindowData* data = (WindowData*) g_object_get_data(G_OBJECT(window), WINDOW_DATA_KEY); - g_signal_handler_disconnect (view, data->signal_id); + g_signal_handler_disconnect(view, data->signal_id); - g_object_set_data (G_OBJECT (window), - WINDOW_DATA_KEY, - NULL); + g_object_set_data(G_OBJECT(window), WINDOW_DATA_KEY, NULL); } -static void -impl_update_ui (EomPlugin *plugin, - EomWindow *window) +static void impl_update_ui(EomPlugin* plugin, EomWindow* window) { + /* Nothing */ } -static void -eom_fullscreen_plugin_class_init (EomFullscreenPluginClass *klass) +static void eom_fullscreen_plugin_class_init(EomFullscreenPluginClass* klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - EomPluginClass *plugin_class = EOM_PLUGIN_CLASS (klass); + GObjectClass* object_class = G_OBJECT_CLASS(klass); + EomPluginClass* plugin_class = EOM_PLUGIN_CLASS(klass); object_class->finalize = eom_fullscreen_plugin_finalize; diff --git a/plugins/fullscreen/eom-fullscreen-plugin.h b/plugins/fullscreen/eom-fullscreen-plugin.h index 2df3a3f..defe3b5 100644 --- a/plugins/fullscreen/eom-fullscreen-plugin.h +++ b/plugins/fullscreen/eom-fullscreen-plugin.h @@ -10,43 +10,47 @@ G_BEGIN_DECLS /* * Type checking and casting macros */ -#define EOM_TYPE_FULLSCREEN_PLUGIN (eom_fullscreen_plugin_get_type ()) -#define EOM_FULLSCREEN_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPlugin)) -#define EOM_FULLSCREEN_PLUGIN_CLASS(k) G_TYPE_CHECK_CLASS_CAST((k), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPluginClass)) -#define EOM_IS_FULLSCREEN_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EOM_TYPE_FULLSCREEN_PLUGIN)) -#define EOM_IS_FULLSCREEN_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EOM_TYPE_FULLSCREEN_PLUGIN)) -#define EOM_FULLSCREEN_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPluginClass)) +#define EOM_TYPE_FULLSCREEN_PLUGIN \ + (eom_fullscreen_plugin_get_type()) +#define EOM_FULLSCREEN_PLUGIN(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPlugin)) +#define EOM_FULLSCREEN_PLUGIN_CLASS(k) \ + G_TYPE_CHECK_CLASS_CAST((k), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPluginClass)) +#define EOM_IS_FULLSCREEN_PLUGIN(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), EOM_TYPE_FULLSCREEN_PLUGIN)) +#define EOM_IS_FULLSCREEN_PLUGIN_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE((k), EOM_TYPE_FULLSCREEN_PLUGIN)) +#define EOM_FULLSCREEN_PLUGIN_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), EOM_TYPE_FULLSCREEN_PLUGIN, EomFullscreenPluginClass)) /* Private structure type */ -typedef struct _EomFullscreenPluginPrivate EomFullscreenPluginPrivate; +typedef struct _EomFullscreenPluginPrivate EomFullscreenPluginPrivate; /* * Main object structure */ -typedef struct _EomFullscreenPlugin EomFullscreenPlugin; +typedef struct _EomFullscreenPlugin EomFullscreenPlugin; -struct _EomFullscreenPlugin -{ +struct _EomFullscreenPlugin { EomPlugin parent_instance; }; /* * Class definition */ -typedef struct _EomFullscreenPluginClass EomFullscreenPluginClass; +typedef struct _EomFullscreenPluginClass EomFullscreenPluginClass; -struct _EomFullscreenPluginClass -{ +struct _EomFullscreenPluginClass { EomPluginClass parent_class; }; /* * Public methods */ -GType eom_fullscreen_plugin_get_type (void) G_GNUC_CONST; +GType eom_fullscreen_plugin_get_type(void) G_GNUC_CONST; /* All the plugins must implement this function */ -G_MODULE_EXPORT GType register_eom_plugin (GTypeModule *module); +G_MODULE_EXPORT GType register_eom_plugin(GTypeModule* module); G_END_DECLS |