[eog] Delay display initialization to avoid losing event timestamp
- From: Felix Riemann <friemann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Delay display initialization to avoid losing event timestamp
- Date: Sun, 6 Oct 2013 13:39:27 +0000 (UTC)
commit 997742b4f0d9023d402f5e7a519aca12fba2be46
Author: John Hiesey <jhiesey gmail com>
Date: Sat Sep 7 01:02:51 2013 +0000
Delay display initialization to avoid losing event timestamp
Should fix a new window not receiving focus when opening another
image from Nautilus.
https://bugzilla.gnome.org/show_bug.cgi?id=582931
src/eog-application.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++-
src/main.c | 54 +-----------------------------------------
2 files changed, 62 insertions(+), 54 deletions(-)
---
diff --git a/src/eog-application.c b/src/eog-application.c
index 6c5bc88..f4cb9ae 100644
--- a/src/eog-application.c
+++ b/src/eog-application.c
@@ -27,8 +27,11 @@
#endif
#include "eog-config-keys.h"
+#include "eog-debug.h"
#include "eog-image.h"
+#include "eog-job-scheduler.h"
#include "eog-session.h"
+#include "eog-thumbnail.h"
#include "eog-window.h"
#include "eog-application.h"
#include "eog-application-activatable.h"
@@ -42,8 +45,14 @@
#include <glib-object.h>
#include <gtk/gtk.h>
+#if HAVE_EXEMPI
+#include <exempi/xmp.h>
+#endif
+
#define APPLICATION_SERVICE_NAME "org.gnome.eog.ApplicationService"
+#define EOG_CSS_FILE_PATH EOG_DATA_DIR G_DIR_SEPARATOR_S "eog.css"
+
static void eog_application_load_accelerators (void);
static void eog_application_save_accelerators (void);
@@ -222,9 +231,59 @@ eog_application_init_app_menu (EogApplication *application)
static void
eog_application_startup (GApplication *application)
{
+ EogApplication *app = EOG_APPLICATION (application);
+ GError *error = NULL;
+ GtkSettings *settings;
+ GtkCssProvider *provider;
+
G_APPLICATION_CLASS (eog_application_parent_class)->startup (application);
- eog_application_init_app_menu (EOG_APPLICATION (application));
+#ifdef HAVE_EXEMPI
+ xmp_init();
+#endif
+ eog_debug_init ();
+ eog_job_scheduler_init ();
+ eog_thumbnail_init ();
+
+ /* Load special style properties for EogThumbView's scrollbar */
+ provider = gtk_css_provider_new ();
+ if (G_UNLIKELY (!gtk_css_provider_load_from_path(provider,
+ EOG_CSS_FILE_PATH,
+ &error)))
+ {
+ g_critical ("Could not load CSS data: %s", error->message);
+ g_clear_error (&error);
+ } else {
+ gtk_style_context_add_provider_for_screen (
+ gdk_screen_get_default(),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ g_object_unref (provider);
+
+ /* Add application specific icons to search path */
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
+ EOG_DATA_DIR G_DIR_SEPARATOR_S "icons");
+
+ gtk_window_set_default_icon_name ("eog");
+ g_set_application_name (_("Image Viewer"));
+
+ settings = gtk_settings_get_default ();
+ g_object_set (G_OBJECT (settings),
+ "gtk-application-prefer-dark-theme", TRUE,
+ NULL);
+
+ eog_application_init_app_menu (app);
+}
+
+static void
+eog_application_shutdown (GApplication *application)
+{
+#ifdef HAVE_EXEMPI
+ xmp_terminate();
+#endif
+
+ G_APPLICATION_CLASS (eog_application_parent_class)->shutdown (application);
}
static void
@@ -326,6 +385,7 @@ eog_application_class_init (EogApplicationClass *eog_application_class)
object_class->finalize = eog_application_finalize;
application_class->startup = eog_application_startup;
+ application_class->shutdown = eog_application_shutdown;
application_class->activate = eog_application_activate;
application_class->open = eog_application_open;
application_class->add_platform_data = eog_application_add_platform_data;
diff --git a/src/main.c b/src/main.c
index 7ae06d5..1483b0d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,10 +30,6 @@
#include <girepository.h>
#endif
-#include "eog-session.h"
-#include "eog-debug.h"
-#include "eog-thumbnail.h"
-#include "eog-job-scheduler.h"
#include "eog-application.h"
#include "eog-application-internal.h"
#include "eog-plugin-engine.h"
@@ -43,16 +39,10 @@
#include <stdlib.h>
#include <glib/gi18n.h>
-#if HAVE_EXEMPI
-#include <exempi/xmp.h>
-#endif
-
#if HAVE_RSVG
#include <librsvg/rsvg.h>
#endif
-#define EOG_CSS_FILE_PATH EOG_DATA_DIR G_DIR_SEPARATOR_S "eog.css"
-
static EogStartupFlags flags;
static gboolean fullscreen = FALSE;
@@ -60,7 +50,6 @@ static gboolean slide_show = FALSE;
static gboolean disable_gallery = FALSE;
static gboolean force_new_instance = FALSE;
static gboolean single_window = FALSE;
-static gchar **startup_files = NULL;
static gboolean
_print_version_and_exit (const gchar *option_name,
@@ -106,8 +95,6 @@ main (int argc, char **argv)
{
GError *error = NULL;
GOptionContext *ctx;
- GtkSettings *settings;
- GtkCssProvider *provider;
bindtextdomain (PACKAGE, EOG_LOCALE_DIR);
bind_textdomain_codeset (PACKAGE, "UTF-8");
@@ -117,7 +104,7 @@ main (int argc, char **argv)
g_option_context_add_main_entries (ctx, goption_options, PACKAGE);
/* Option groups are free'd together with the context
* Using gtk_get_option_group here initializes gtk during parsing */
- g_option_context_add_group (ctx, gtk_get_option_group (TRUE));
+ g_option_context_add_group (ctx, gtk_get_option_group (FALSE));
#ifdef HAVE_INTROSPECTION
g_option_context_add_group (ctx, g_irepository_get_option_group ());
#endif
@@ -138,44 +125,8 @@ main (int argc, char **argv)
}
g_option_context_free (ctx);
-
set_startup_flags ();
-
-#ifdef HAVE_EXEMPI
- xmp_init();
-#endif
- eog_debug_init ();
- eog_job_scheduler_init ();
gdk_threads_init ();
- eog_thumbnail_init ();
-
- /* Load special style properties for EogThumbView's scrollbar */
- provider = gtk_css_provider_new ();
- if (G_UNLIKELY (!gtk_css_provider_load_from_path(provider,
- EOG_CSS_FILE_PATH,
- &error)))
- {
- g_critical ("Could not load CSS data: %s", error->message);
- g_clear_error (&error);
- } else {
- gtk_style_context_add_provider_for_screen (
- gdk_screen_get_default(),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
- }
- g_object_unref (provider);
-
- /* Add application specific icons to search path */
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- EOG_DATA_DIR G_DIR_SEPARATOR_S "icons");
-
- gtk_window_set_default_icon_name ("eog");
- g_set_application_name (_("Image Viewer"));
-
- settings = gtk_settings_get_default ();
- g_object_set (G_OBJECT (settings),
- "gtk-application-prefer-dark-theme", TRUE,
- NULL);
EOG_APP->priv->flags = flags;
if (force_new_instance) {
@@ -187,9 +138,6 @@ main (int argc, char **argv)
g_application_run (G_APPLICATION (EOG_APP), argc, argv);
g_object_unref (EOG_APP);
- if (startup_files)
- g_strfreev (startup_files);
-
#ifdef HAVE_EXEMPI
xmp_terminate();
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]