Merge lp:~3v1n0/empathy/empathy-activate-with-platform-data into lp:~ubuntu-desktop/empathy/ubuntu

Proposed by Marco Trevisan (Treviño) on 2013-04-03
Status: Merged
Merged at revision: 332
Proposed branch: lp:~3v1n0/empathy/empathy-activate-with-platform-data
Merge into: lp:~ubuntu-desktop/empathy/ubuntu
Diff against target: 242 lines (+222/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/47_git_activate_with_platform_data.patch (+213/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/empathy/empathy-activate-with-platform-data
Reviewer Review Type Date Requested Status
Ubuntu Desktop 2013-04-03 Pending
Review via email: mp+156913@code.launchpad.net

Commit Message

debian/patches/47_activate_with_platform_data.patch:
  - Use g_application_activate to pass platform-data to the GtkApplication
    when running it. (LP: #627195)

Description of the Change

Empathy is acting as a command-line application, while it is not and it needs to pass the platform-data to the gtk-application in order to work correctly with focus stealing prevention mechanism of the current WMs.
To do this we need to use g_application_activate instead of the manual command-line handling and to avoid that gtk_init would unset the DESKTOP_STARTUP_ID variable.

Indicator-messages needs lp:~3v1n0/indicator-messages/launch-app-with-timestamp/+merge/156892 in order to work correctly with this too.

Upstream porting in progress: https://bugzilla.gnome.org/show_bug.cgi?id=697197

To post a comment you must log in.
333. By Marco Trevisan (Treviño) on 2013-04-04

debian/patches/47_activate_with_platform_data.patch: enable startup notify on .desktop file

334. By Marco Trevisan (Treviño) on 2013-04-04

debian/patches/47_activate_with_platform_data.patch: use GAction to pass command-line to main instance

335. By Marco Trevisan (Treviño) on 2013-04-04

debian/patches/47_activate_with_platform_data.patch: Sync with git and fix gtk warnings

Using patches from git or proposed in bugzilla.

336. By Marco Trevisan (Treviño) on 2013-04-04

debian/patches/47_git_activate_with_platform_data.patch: sync with git improvements

Such as not activating the app if the command-line is wrong

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-03-26 12:52:23 +0000
3+++ debian/changelog 2013-04-04 21:59:22 +0000
4@@ -1,3 +1,11 @@
5+empathy (3.6.4-0ubuntu3) UNRELEASED; urgency=low
6+
7+ * debian/patches/47_git_activate_with_platform_data.patch:
8+ - Use g_application_activate to pass platform-data to the GtkApplication
9+ when running it. (LP: #627195)
10+
11+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 03 Apr 2013 18:24:18 +0200
12+
13 empathy (3.6.4-0ubuntu2) raring; urgency=low
14
15 * debian/control: let account plugins depend on unity-asset-pool rather
16
17=== added file 'debian/patches/47_git_activate_with_platform_data.patch'
18--- debian/patches/47_git_activate_with_platform_data.patch 1970-01-01 00:00:00 +0000
19+++ debian/patches/47_git_activate_with_platform_data.patch 2013-04-04 21:59:22 +0000
20@@ -0,0 +1,213 @@
21+Index: empathy-3.6.4/src/empathy.c
22+===================================================================
23+--- empathy-3.6.4.orig/src/empathy.c 2012-10-09 16:12:45.000000000 +0200
24++++ empathy-3.6.4/src/empathy.c 2013-04-04 23:53:47.908540073 +0200
25+@@ -231,11 +231,6 @@
26+ g_object_unref (handler);
27+ }
28+
29+-static gboolean
30+-empathy_app_local_command_line (GApplication *app,
31+- gchar ***arguments,
32+- gint *exit_status);
33+-
34+ static void
35+ empathy_presence_manager_set_auto_away_cb (GSettings *gsettings,
36+ const gchar *key,
37+@@ -302,32 +297,18 @@
38+ }
39+ }
40+
41+-static int
42+-empathy_app_command_line (GApplication *app,
43+- GApplicationCommandLine *cmdline)
44++static void
45++empathy_app_activate (GApplication *app)
46+ {
47+ EmpathyApp *self = (EmpathyApp *) app;
48+- gchar **args, **argv;
49+- gint argc, exit_status, i;
50+-
51+- args = g_application_command_line_get_arguments (cmdline, &argc);
52+- /* We have to make an extra copy of the array, since g_option_context_parse()
53+- * assumes that it can remove strings from the array without freeing them. */
54+- argv = g_new (gchar*, argc + 1);
55+- for (i = 0; i <= argc; i++)
56+- argv[i] = args[i];
57+-
58+- if (empathy_app_local_command_line (app, &argv, &exit_status))
59+- DEBUG ("failed to parse command line!");
60+-
61+- g_free (argv);
62+- g_strfreev (args);
63+
64+ if (!self->activated)
65+ {
66+ GError *error = NULL;
67+ TpDBusDaemon *dbus;
68+
69++ empathy_gtk_init ();
70++
71+ /* Create the FT factory */
72+ self->ft_factory = empathy_ft_factory_dup_singleton ();
73+ g_signal_connect (self->ft_factory, "new-ft-handler",
74+@@ -371,17 +352,22 @@
75+ }
76+
77+ if (self->show_preferences)
78+- empathy_roster_window_show_preferences (
79+- EMPATHY_ROSTER_WINDOW (self->window), self->preferences_tab);
80++ {
81++ empathy_roster_window_show_preferences (
82++ EMPATHY_ROSTER_WINDOW (self->window),
83++ tp_str_empty (self->preferences_tab) ? NULL : self->preferences_tab);
84+
85+- if (!self->start_hidden)
86+- empathy_window_present (GTK_WINDOW (self->window));
87++ self->show_preferences = FALSE;
88++ }
89++ else
90++ {
91++ if (!self->start_hidden)
92++ empathy_window_present (GTK_WINDOW (self->window));
93++ }
94+
95+ /* Display the accounts dialog if needed */
96+ tp_proxy_prepare_async (self->account_manager, NULL,
97+ account_manager_ready_cb, self);
98+-
99+- return 0;
100+ }
101+
102+ static gboolean
103+@@ -406,16 +392,30 @@
104+ gpointer data,
105+ GError **error);
106+
107++static void
108++open_preference_action_cb (GAction *action,
109++ GVariant *parameter,
110++ gpointer data)
111++{
112++ EmpathyApp *self = EMPATHY_APP (data);
113++
114++ self->show_preferences = TRUE;
115++
116++ g_free (self->preferences_tab);
117++ self->preferences_tab = g_variant_dup_string (parameter, NULL);
118++}
119++
120+ static gboolean
121+ empathy_app_local_command_line (GApplication *app,
122+ gchar ***arguments,
123+ gint *exit_status)
124+ {
125+ EmpathyApp *self = (EmpathyApp *) app;
126++ GSimpleAction *action;
127+ gint i;
128+ gchar **argv;
129+ gint argc = 0;
130+- gboolean retval = FALSE;
131++ gboolean retval = TRUE;
132+ GError *error = NULL;
133+ gboolean no_connect = FALSE, start_hidden = FALSE;
134+
135+@@ -439,13 +439,26 @@
136+ { NULL }
137+ };
138+
139++ if (!g_application_register (app, NULL, &error))
140++ {
141++ g_warning("Impossible to register empathy: %s", error->message);
142++ g_clear_error (&error);
143++ *exit_status = EXIT_FAILURE;
144++ return retval;
145++ }
146++
147++ action = g_simple_action_new ("open-preferences", G_VARIANT_TYPE_STRING);
148++ g_signal_connect (action, "activate", G_CALLBACK (open_preference_action_cb), app);
149++ g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (action));
150++ g_object_unref (action);
151++
152+ /* We create a group so that GOptionArgFuncs get the user data */
153+ group = g_option_group_new ("empathy", NULL, NULL, app, NULL);
154+ g_option_group_set_translation_domain (group, GETTEXT_PACKAGE);
155+ g_option_group_add_entries (group, options);
156+
157+ optcontext = g_option_context_new (N_("- Empathy IM Client"));
158+- g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
159++ g_option_context_add_group (optcontext, gtk_get_option_group (FALSE));
160+ g_option_context_set_main_group (optcontext, group);
161+ g_option_context_set_translation_domain (optcontext, GETTEXT_PACKAGE);
162+
163+@@ -464,17 +477,27 @@
164+ "line options.\n",
165+ error->message, argv[0]);
166+ g_warning ("Error in empathy init: %s", error->message);
167++ g_clear_error (&error);
168+
169+ *exit_status = EXIT_FAILURE;
170+- retval = TRUE;
171+ }
172++ else
173++ {
174++ self->no_connect = no_connect;
175++ self->start_hidden = start_hidden;
176+
177+- g_free (argv);
178++ if (self->show_preferences)
179++ {
180++ GVariant *parameter;
181++ parameter = g_variant_new_string (self->preferences_tab ? self->preferences_tab : "");
182++ g_action_group_activate_action (G_ACTION_GROUP (app), "open-preferences", parameter);
183++ }
184+
185+- g_option_context_free (optcontext);
186++ g_application_activate (app);
187++ }
188+
189+- self->no_connect = no_connect;
190+- self->start_hidden = start_hidden;
191++ g_free (argv);
192++ g_option_context_free (optcontext);
193+
194+ return retval;
195+ }
196+@@ -493,8 +516,8 @@
197+ gobject_class->dispose = empathy_app_dispose;
198+ gobject_class->finalize = empathy_app_finalize;
199+
200+- g_app_class->command_line = empathy_app_command_line;
201+ g_app_class->local_command_line = empathy_app_local_command_line;
202++ g_app_class->activate = empathy_app_activate;
203+
204+ spec = g_param_spec_boolean ("no-connect", "no connect",
205+ "Don't connect on startup",
206+@@ -829,14 +852,11 @@
207+
208+ g_type_init ();
209+ empathy_init ();
210+- gtk_init (&argc, &argv);
211+- empathy_gtk_init ();
212+
213+ add_empathy_features ();
214+
215+ app = g_object_new (EMPATHY_TYPE_APP,
216+ "application-id", EMPATHY_DBUS_NAME,
217+- "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
218+ NULL);
219+
220+ retval = g_application_run (G_APPLICATION (app), argc, argv);
221+Index: empathy-3.6.4/data/empathy.desktop.in.in
222+===================================================================
223+--- empathy-3.6.4.orig/data/empathy.desktop.in.in 2013-04-03 18:07:04.000000000 +0200
224++++ empathy-3.6.4/data/empathy.desktop.in.in 2013-04-04 23:53:47.892540080 +0200
225+@@ -6,7 +6,7 @@
226+ _Comment=Chat on Google Talk, Facebook, MSN and many other chat services
227+ Exec=empathy
228+ Icon=empathy
229+-StartupNotify=false
230++StartupNotify=true
231+ Terminal=false
232+ Type=Application
233+ Categories=GNOME;GTK;Network;InstantMessaging;
234
235=== modified file 'debian/patches/series'
236--- debian/patches/series 2013-02-27 15:32:01 +0000
237+++ debian/patches/series 2013-04-04 21:59:22 +0000
238@@ -9,3 +9,4 @@
239 45_uoa_errors.patch
240 46_uoa_link.patch
241 00_linker-fixes.patch
242+47_activate_with_platform_data.patch

Subscribers

People subscribed via source and target branches