[gthumb/ext] implemented --slideshow and --fullscreen command line arguments
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] implemented --slideshow and --fullscreen command line arguments
- Date: Wed, 9 Sep 2009 11:53:09 +0000 (UTC)
commit c2d4480ddd93000ddc70c776e7974cb924f2964e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Sep 9 13:52:34 2009 +0200
implemented --slideshow and --fullscreen command line arguments
extensions/slideshow/callbacks.c | 7 +++++++
extensions/slideshow/callbacks.h | 1 +
extensions/slideshow/gth-slideshow.c | 19 +++++++++++++++++--
extensions/slideshow/main.c | 1 +
gthumb/gth-browser.c | 14 +++++++++++---
gthumb/gth-extensions.c | 3 ++-
gthumb/gth-main-default-hooks.c | 9 +++++++++
gthumb/main.c | 13 +++++++++++--
8 files changed, 59 insertions(+), 8 deletions(-)
---
diff --git a/extensions/slideshow/callbacks.c b/extensions/slideshow/callbacks.c
index 5a6ba4b..5f2b8c7 100644
--- a/extensions/slideshow/callbacks.c
+++ b/extensions/slideshow/callbacks.c
@@ -118,3 +118,10 @@ ss__gth_browser_update_sensitivity_cb (GthBrowser *browser)
sensitive = (gth_file_store_n_visibles (GTH_FILE_STORE (file_store)) > 0);
set_action_sensitive (data, "View_Slideshow", sensitive);
}
+
+
+void
+ss__slideshow_cb (GthBrowser *browser)
+{
+ gth_browser_activate_action_view_slideshow (NULL, browser);
+}
diff --git a/extensions/slideshow/callbacks.h b/extensions/slideshow/callbacks.h
index a6d7c71..f1e4cf7 100644
--- a/extensions/slideshow/callbacks.h
+++ b/extensions/slideshow/callbacks.h
@@ -27,5 +27,6 @@
void ss__gth_browser_construct_cb (GthBrowser *browser);
void ss__gth_browser_update_sensitivity_cb (GthBrowser *browser);
+void ss__slideshow_cb (GthBrowser *browser);
#endif /* CALLBACKS_H */
diff --git a/extensions/slideshow/gth-slideshow.c b/extensions/slideshow/gth-slideshow.c
index a45cb5b..b9089ab 100644
--- a/extensions/slideshow/gth-slideshow.c
+++ b/extensions/slideshow/gth-slideshow.c
@@ -57,6 +57,21 @@ static gpointer parent_class = NULL;
static void
+_gth_slideshow_close (GthSlideshow *self)
+{
+ gboolean close_browser;
+ GthBrowser *browser;
+
+ browser = self->priv->browser;
+ close_browser = ! GTK_WIDGET_VISIBLE (browser);
+ gtk_widget_destroy (GTK_WIDGET (self));
+
+ if (close_browser)
+ gth_window_close (GTH_WINDOW (browser));
+}
+
+
+static void
_gth_slideshow_load_current_image (GthSlideshow *self)
{
if (self->priv->next_event != 0) {
@@ -66,7 +81,7 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
if (self->priv->current == NULL) {
if (! self->priv->one_loaded || ! self->priv->loop) {
- gtk_widget_destroy (GTK_WIDGET (self));
+ _gth_slideshow_close (self);
return;
}
@@ -441,7 +456,7 @@ stage_input_cb (ClutterStage *stage,
else if (event->type == CLUTTER_KEY_RELEASE) {
switch (clutter_event_get_key_symbol (event)) {
case CLUTTER_Escape:
- gtk_widget_destroy (GTK_WIDGET (self));
+ _gth_slideshow_close (self);
break;
case CLUTTER_space:
diff --git a/extensions/slideshow/main.c b/extensions/slideshow/main.c
index 0df9ce0..1654df6 100644
--- a/extensions/slideshow/main.c
+++ b/extensions/slideshow/main.c
@@ -314,6 +314,7 @@ gthumb_extension_activate (void)
"frame-func", cube_from_bottom_transition,
NULL);
+ gth_hook_add_callback ("slideshow", 10, G_CALLBACK (ss__slideshow_cb), NULL);
gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (ss__gth_browser_construct_cb), NULL);
gth_hook_add_callback ("gth-browser-update-sensitivity", 10, G_CALLBACK (ss__gth_browser_update_sensitivity_cb), NULL);
gth_hook_add_callback ("dlg-preferences-construct", 20, G_CALLBACK (ss__dlg_preferences_construct_cb), NULL);
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index eaa60da..0e3ec08 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -55,6 +55,7 @@
#include "gth-window-actions-callbacks.h"
#include "gth-window-actions-entries.h"
#include "gthumb-error.h"
+#include "main.h"
#define GTH_BROWSER_CALLBACK(f) ((GthBrowserCallback) (f))
#define GO_BACK_HISTORY_POPUP "/GoBackHistoryPopup"
@@ -1429,6 +1430,16 @@ load_data_continue (LoadData *load_data,
browser->priv->location->file,
TRUE);
+ if (StartSlideshow) {
+ StartSlideshow = FALSE;
+ gth_hook_invoke ("slideshow", browser);
+ }
+
+ if (StartInFullscreen) {
+ StartInFullscreen = FALSE;
+ gth_browser_fullscreen (browser);
+ }
+
if (path != NULL)
gtk_tree_path_free (path);
load_data_free (load_data);
@@ -2887,9 +2898,6 @@ _gth_browser_construct_step2 (gpointer data)
_gth_browser_update_bookmark_list (browser);
_gth_browser_monitor_entry_points (browser);
-
- /* force an update to load the correct icons */
- /*gth_monitor_file_entry_points_changed (gth_main_get_default_monitor ()); FIXME: not required anymore ? */
}
diff --git a/gthumb/gth-extensions.c b/gthumb/gth-extensions.c
index 66580d6..e4bae09 100644
--- a/gthumb/gth-extensions.c
+++ b/gthumb/gth-extensions.c
@@ -595,7 +595,8 @@ gth_extension_manager_finalize (GObject *obj)
self = GTH_EXTENSION_MANAGER (obj);
- g_hash_table_destroy (self->priv->extensions);
+ if (self->priv->extensions != NULL)
+ g_hash_table_destroy (self->priv->extensions);
G_OBJECT_CLASS (gth_extension_manager_parent_class)->finalize (obj);
}
diff --git a/gthumb/gth-main-default-hooks.c b/gthumb/gth-main-default-hooks.c
index d3f0b11..7cdf5ce 100644
--- a/gthumb/gth-main-default-hooks.c
+++ b/gthumb/gth-main-default-hooks.c
@@ -195,4 +195,13 @@ gth_main_register_default_hooks (void)
* @file (GFile *): import from this location
**/
gth_hook_register ("import-photos", 2);
+
+
+ /**
+ * Called at start up time if the --slideshow argument is
+ * specified.
+ *
+ * @browser (GthBrowser*): the main window.
+ **/
+ gth_hook_register ("slideshow", 1);
}
diff --git a/gthumb/main.c b/gthumb/main.c
index 85a865b..78b4022 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -40,7 +40,9 @@
enum {
COMMAND_UNUSED,
- COMMAND_IMPORT_PHOTOS
+ COMMAND_FULLSCREEN,
+ COMMAND_IMPORT_PHOTOS,
+ COMMAND_SLIDESHOW
};
@@ -216,6 +218,12 @@ unique_app_message_received_cb (UniqueApp *unique_app,
g_free (uri);
break;
+ case COMMAND_SLIDESHOW:
+ window = gth_window_get_current_window ();
+ if (window == NULL)
+ window = gth_browser_new (NULL);
+ gth_hook_invoke ("slideshow", window, NULL);
+
default:
res = UNIQUE_RESPONSE_PASSTHROUGH;
break;
@@ -244,7 +252,8 @@ open_browser_window (GFile *location)
GtkWidget *window;
window = gth_browser_new (NULL);
- gtk_widget_show (window);
+ if (! StartSlideshow)
+ gtk_window_present (GTK_WINDOW (window));
gth_browser_load_location (GTH_BROWSER (window), location);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]