[cheese/gtk3] cheese: Using Gtk.Application instead of libunique
- From: Luciana Fujii Pontello <lufujii src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese/gtk3] cheese: Using Gtk.Application instead of libunique
- Date: Fri, 18 Feb 2011 21:00:28 +0000 (UTC)
commit 4e71d919b232071906c3efbd2ce576704b6a2d37
Author: Luciana Fujii Pontello <luciana fujii eti br>
Date: Thu Feb 17 23:01:06 2011 -0200
cheese: Using Gtk.Application instead of libunique
src/Makefile.am | 1 -
src/cheese-main.vala | 62 +++++++++++++++++--------------------------------
2 files changed, 22 insertions(+), 41 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7adcf2a..f85db77 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -8,7 +8,6 @@ VALAFLAGS = \
--pkg clutter-1.0 \
--pkg clutter-gtk-1.0 \
--pkg gstreamer-0.10 \
- --pkg Unique-3.0 \
--pkg libcanberra \
--pkg libcanberra-gtk \
--pkg eogthumbnav \
diff --git a/src/cheese-main.vala b/src/cheese-main.vala
index f02b400..b20ad54 100644
--- a/src/cheese-main.vala
+++ b/src/cheese-main.vala
@@ -23,7 +23,6 @@ using GLib;
using Gtk;
using Clutter;
using Gst;
-using Unique;
public class Cheese.Main
{
@@ -32,7 +31,6 @@ public class Cheese.Main
static bool version;
static bool fullscreen;
- static Cheese.MainWindow main_window;
const OptionEntry[] options = {
{"wide", 'w', 0, OptionArg.NONE, ref wide, N_("Start in wide mode"), null },
@@ -42,16 +40,27 @@ public class Cheese.Main
{null}
};
- public static Unique.Response unique_message_received (int command,
- Unique.MessageData msg,
- uint time)
+ public static void activate_cb (GLib.Application app)
{
- if (command == Unique.Command.ACTIVATE)
+ Cheese.MainWindow main_window;
+ main_window = new Cheese.MainWindow ();
+ main_window.set_application ((Gtk.Application) app);
+
+ main_window.setup_ui ();
+
+ if (wide)
{
- main_window.set_screen (msg.get_screen ());
- main_window.activate ();
+ main_window.set_startup_wide_mode ();
}
- return Unique.Response.OK;
+
+ if (fullscreen)
+ {
+ main_window.set_startup_fullscreen_mode ();
+ }
+
+ main_window.destroy.connect (Gtk.main_quit);
+ main_window.show ();
+ main_window.setup_camera (device);
}
public static int main (string[] args)
@@ -86,43 +95,16 @@ public class Cheese.Main
return 0;
}
- main_window = new Cheese.MainWindow ();
+ Gtk.Application app = new Gtk.Application ("org.gnome.Cheese", 0);
+ app.activate.connect (activate_cb);
- Unique.App app = new Unique.App ("org.gnome.Cheese", "");
- if (app.is_running)
- {
- Unique.Response response;
- response = app.send_message (Unique.Command.ACTIVATE, null);
- return 0;
- }
- else
- {
- app.watch_window (main_window);
- app.message_received.connect (unique_message_received);
- }
+ int status = app.run ();
Environment.set_application_name (_("Cheese"));
Window.set_default_icon_name ("cheese");
Gtk.IconTheme.get_default ().append_search_path (GLib.Path.build_filename (Config.PACKAGE_DATADIR, "icons"));
- main_window.setup_ui ();
-
- if (wide)
- {
- main_window.set_startup_wide_mode ();
- }
-
- if (fullscreen)
- {
- main_window.set_startup_fullscreen_mode ();
- }
-
- main_window.destroy.connect (Gtk.main_quit);
- main_window.show ();
- main_window.setup_camera (device);
- Gtk.main ();
-
- return 0;
+ return status;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]