]> www.fi.muni.cz Git - evince.git/commitdiff
Move screensaver handling to application. No more message on startup.
authorNickolay V. Shmyrev <nshmyrev@yandex.ru>
Sun, 3 Dec 2006 20:54:44 +0000 (20:54 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sun, 3 Dec 2006 20:54:44 +0000 (20:54 +0000)
2006-12-03  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>

* cut-n-paste/totem-screensaver/totem-scrsaver.c:
(screensaver_init_dbus), (totem_scrsaver_new),
(totem_scrsaver_init):
* cut-n-paste/totem-screensaver/totem-scrsaver.h:
* shell/ev-application.c: (ev_application_register_service),
(ev_application_screensaver_enable),
(ev_application_screensaver_disable):
* shell/ev-application.h:
* shell/ev-window.c: (ev_window_run_presentation),
(ev_window_stop_presentation), (build_comments_string),
(ev_window_init):

Move screensaver handling to application. No more
message on startup.

ChangeLog
cut-n-paste/totem-screensaver/totem-scrsaver.c
cut-n-paste/totem-screensaver/totem-scrsaver.h
shell/ev-application.c
shell/ev-application.h
shell/ev-window.c

index d52d0231a3b602de7f86e24a88c5b1fc5c780c20..f2ac63069df02d96a2143064655e9d1c6043dbdb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-12-03  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * cut-n-paste/totem-screensaver/totem-scrsaver.c:
+       (screensaver_init_dbus), (totem_scrsaver_new),
+       (totem_scrsaver_init):
+       * cut-n-paste/totem-screensaver/totem-scrsaver.h:
+       * shell/ev-application.c: (ev_application_register_service),
+       (ev_application_screensaver_enable),
+       (ev_application_screensaver_disable):
+       * shell/ev-application.h:
+       * shell/ev-window.c: (ev_window_run_presentation),
+       (ev_window_stop_presentation), (build_comments_string),
+       (ev_window_init):
+       
+       Move screensaver handling to application. No more
+       message on startup.
+
 2006-12-03  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * configure.ac:
index 18c94317c79ac6dd0da59bc0c3dd4a934bb169ad..1990b0c11b5069978dc5b7d0dabce3693f5fc286 100644 (file)
@@ -188,13 +188,16 @@ gs_proxy_destroy_cb (GObject *proxy,
 }
 #endif
 
+#ifdef ENABLE_DBUS
 static void
-screensaver_init_dbus (TotemScrsaver *scr)
+screensaver_init_dbus (TotemScrsaver *scr, DBusGConnection *connection)
 {
-#ifdef ENABLE_DBUS
        GError *error = NULL;
 
-       scr->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+       if (!connection)
+               scr->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
+       else
+               scr->priv->connection = connection;
 
        if (! scr->priv->connection) {
                if (error) {
@@ -218,8 +221,8 @@ screensaver_init_dbus (TotemScrsaver *scr)
 
        }
 
-#endif /* ENABLE_DBUS */
 }
+#endif /* ENABLE_DBUS */
 
 static void
 screensaver_finalize_dbus (TotemScrsaver *scr)
@@ -355,19 +358,35 @@ totem_scrsaver_class_init (TotemScrsaverClass *klass)
        object_class->finalize = totem_scrsaver_finalize;
 }
 
+#ifdef ENABLE_DBUS
+TotemScrsaver *
+totem_scrsaver_new     (DBusGConnection *connection)
+{
+       TotemScrsaver * scr;
+       scr = TOTEM_SCRSAVER (g_object_new (TOTEM_TYPE_SCRSAVER, NULL));
+
+       screensaver_init_dbus (scr, connection);
+       screensaver_init_x11 (scr);
+       
+       return scr;
+}
+#else
 TotemScrsaver *
-totem_scrsaver_new (void)
+totem_scrsaver_new()
 {
-       return TOTEM_SCRSAVER (g_object_new (TOTEM_TYPE_SCRSAVER, NULL));
+       TotemScrsaver * scr;
+       scr = TOTEM_SCRSAVER (g_object_new (TOTEM_TYPE_SCRSAVER, NULL));
+
+       screensaver_init_x11 (scr);
+       
+       return scr;
 }
+#endif
 
 static void
 totem_scrsaver_init (TotemScrsaver *scr)
 {
        scr->priv = g_new0 (TotemScrsaverPrivate, 1);
-
-       screensaver_init_dbus (scr);
-       screensaver_init_x11 (scr);
 }
 
 void
index f34fb15b4a77f7df5aa6c4a6bd5e31c622994108..e84299a072fd35c82350b47c02f4518408fe83ad 100644 (file)
 #include <glib.h>
 #include <glib-object.h>
 
+#ifdef ENABLE_DBUS
+#include <dbus/dbus-glib.h>
+#endif
+
 #define TOTEM_TYPE_SCRSAVER            (totem_scrsaver_get_type ())
 #define TOTEM_SCRSAVER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TOTEM_TYPE_SCRSAVER, TotemScrsaver))
 #define TOTEM_SCRSAVER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TOTEM_TYPE_SCRSAVER, TotemScrsaverClass))
@@ -43,7 +47,11 @@ struct TotemScrsaverClass {
 };
 
 GType totem_scrsaver_get_type          (void);
-TotemScrsaver *totem_scrsaver_new      (void);
+#ifdef ENABLE_DBUS
+TotemScrsaver *totem_scrsaver_new      (DBusGConnection *connection);
+#else
+TotemScrsaver *totem_scrsaver_new      ();
+#endif
 void totem_scrsaver_enable             (TotemScrsaver *scr);
 void totem_scrsaver_disable            (TotemScrsaver *scr);
 
index 7f912f2deae67e3e804c2b43979f73eecc6b7aa3..aee7390bafb270910767184d52c2d0fa1f023584 100644 (file)
@@ -109,7 +109,9 @@ ev_application_register_service (EvApplication *application)
        dbus_g_connection_register_g_object (connection,
                                             "/org/gnome/evince/Evince",
                                              G_OBJECT (application));
-
+       
+       application->scr_saver = totem_scrsaver_new (connection);
+       
        return TRUE;
 }
 #endif /* ENABLE_DBUS */
@@ -551,3 +553,14 @@ const gchar* ev_application_get_chooser_uri (EvApplication *application)
        return application->last_chooser_uri;
 }
 
+void ev_application_screensaver_enable  (EvApplication   *application)
+{
+       if (application->scr_saver)
+               totem_scrsaver_enable (application->scr_saver); 
+}
+
+void ev_application_screensaver_disable (EvApplication   *application)
+{
+       if (application->scr_saver)
+               totem_scrsaver_disable (application->scr_saver);        
+}
index 4f3ce7e4deaac1186c7ae9f9585749a03b76c3b1..53e97c2e2a7b83bad06d624f0f12a7c68a2d56a1 100644 (file)
@@ -32,6 +32,7 @@
 #ifndef HAVE_GTK_RECENT
 #include "egg-recent-model.h"
 #endif
+#include "totem-scrsaver.h"
 
 G_BEGIN_DECLS
 
@@ -58,6 +59,8 @@ struct _EvApplication {
 #ifndef HAVE_GTK_RECENT
        EggRecentModel  *recent_model;
 #endif
+
+       TotemScrsaver *scr_saver;
        
        gchar *last_chooser_uri;
 };
@@ -103,7 +106,8 @@ EggRecentModel   *ev_application_get_recent_model    (EvApplication   *applicati
 void             ev_application_set_chooser_uri     (EvApplication   *application, 
                                                      const gchar     *uri);
 const gchar     *ev_application_get_chooser_uri     (EvApplication   *application);
-
+void             ev_application_screensaver_enable  (EvApplication   *application);
+void             ev_application_screensaver_disable (EvApplication   *application);
 G_END_DECLS
 
 #endif /* !EV_APPLICATION_H */
index 7ece884f214d8467bcff4b5fdf1d91e941ef0c66..271cfe2756dd3b63ee4d1f79485573acde47a809 100644 (file)
@@ -91,8 +91,6 @@
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <gconf/gconf-client.h>
 
-#include "totem-scrsaver.h"
-
 #include <string.h>
 
 typedef enum {
@@ -153,9 +151,6 @@ struct _EvWindowPrivate {
        GtkWidget *fullscreen_popup;
        guint      fullscreen_timeout_id;
 
-       /* Screensaver */
-       TotemScrsaver *screensaver;
-
        /* Popup link */
        GtkWidget *view_popup;
        EvLink    *link;
@@ -2557,8 +2552,8 @@ ev_window_run_presentation (EvWindow *window)
                          window);
        fullscreen_set_timeout (window);
 
-       totem_scrsaver_disable (window->priv->screensaver);
-
+       ev_application_screensaver_disable (EV_APP);
+       
        if (!ev_window_is_empty (window))
                ev_metadata_manager_set_boolean (window->priv->uri, "presentation", TRUE);
 }
@@ -2585,7 +2580,7 @@ ev_window_stop_presentation (EvWindow *window)
                                              window);
        fullscreen_clear_timeout (window);
 
-       totem_scrsaver_enable (window->priv->screensaver);
+       ev_application_screensaver_enable (EV_APP);
 
        if (!ev_window_is_empty (window))
                ev_metadata_manager_set_boolean (window->priv->uri, "presentation", FALSE);
@@ -3128,7 +3123,7 @@ build_comments_string (void)
                                  "Using poppler %s (%s)"),
                                version, backend_name);
 #else
-       return g_strdup_printf (_("Document Viewer."));
+       return g_strdup_printf (_("Document Viewer"));
 #endif
 }
 
@@ -4652,10 +4647,6 @@ ev_window_init (EvWindow *ev_window)
                                  G_CALLBACK (drag_data_received_cb),
                                  ev_window);
 
-       /* Screensaver */
-
-       ev_window->priv->screensaver = totem_scrsaver_new ();
-
        /* Set it user interface params */
 
        ev_window_setup_recent (ev_window);