+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:
}
#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) {
}
-#endif /* ENABLE_DBUS */
}
+#endif /* ENABLE_DBUS */
static void
screensaver_finalize_dbus (TotemScrsaver *scr)
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
#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))
};
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);
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 */
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);
+}
#ifndef HAVE_GTK_RECENT
#include "egg-recent-model.h"
#endif
+#include "totem-scrsaver.h"
G_BEGIN_DECLS
#ifndef HAVE_GTK_RECENT
EggRecentModel *recent_model;
#endif
+
+ TotemScrsaver *scr_saver;
gchar *last_chooser_uri;
};
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 */
#include <libgnomevfs/gnome-vfs-utils.h>
#include <gconf/gconf-client.h>
-#include "totem-scrsaver.h"
-
#include <string.h>
typedef enum {
GtkWidget *fullscreen_popup;
guint fullscreen_timeout_id;
- /* Screensaver */
- TotemScrsaver *screensaver;
-
/* Popup link */
GtkWidget *view_popup;
EvLink *link;
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);
}
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);
"Using poppler %s (%s)"),
version, backend_name);
#else
- return g_strdup_printf (_("Document Viewer."));
+ return g_strdup_printf (_("Document Viewer"));
#endif
}
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);