blob: 9e7144853ec42902a38e17c221c2cfac36783d0b [file] [log] [blame]
Stepan Salenikovichd81ef292015-02-17 18:47:37 -05001/*
2 * Copyright (C) 2015 Savoir-Faire Linux Inc.
3 * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Additional permission under GNU GPL version 3 section 7:
20 *
21 * If you modify this program, or any covered work, by linking or
22 * combining it with the OpenSSL project's OpenSSL library (or a
23 * modified version of that library), containing parts covered by the
24 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
25 * grants you additional permission to convey the resulting work.
26 * Corresponding Source for a non-source form of such a combination
27 * shall include the source code for the parts of OpenSSL used as well
28 * as that of the covered work.
29 */
30
31#include "ring_client.h"
32
33#include <gtk/gtk.h>
34#include <glib/gi18n.h>
Stepan Salenikovichd2dbcee2015-02-27 16:52:28 -050035#include <QtCore/QCoreApplication>
36#include <QtCore/QString>
37#include <QtCore/QByteArray>
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050038#include <callmodel.h>
Stepan Salenikovichd2dbcee2015-02-27 16:52:28 -050039#include <QtCore/QItemSelectionModel>
Stepan Salenikovichc64523b2015-02-27 16:31:00 -050040#include <useractionmodel.h>
Stepan Salenikovich36c025c2015-03-03 19:06:44 -050041#include <clutter-gtk/clutter-gtk.h>
Stepan Salenikovichdd84cf92015-03-19 21:38:19 -040042#include <categorizedhistorymodel.h>
Stepan Salenikovich6f687072015-03-26 10:43:37 -040043#include <personmodel.h>
44#include <fallbackpersoncollection.h>
45#include <QtCore/QStandardPaths>
Stepan Salenikovich1e131a42015-05-27 14:12:21 -040046#include <localhistorycollection.h>
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050047
48#include "ring_client_options.h"
Stepan Salenikovich434b88f2015-02-19 17:49:08 -050049#include "ringmainwindow.h"
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -040050#include "dialogs.h"
Stepan Salenikovich6f687072015-03-26 10:43:37 -040051#include "backends/edscontactbackend.h"
52#include "delegates/pixbufdelegate.h"
Stepan Salenikovich76c33e62015-05-22 12:24:07 -040053#include "ringnotify.h"
Stepan Salenikovich76350582015-05-25 14:56:32 -040054#include "config.h"
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -040055#include "utils/files.h"
Stepan Salenikovich434b88f2015-02-19 17:49:08 -050056
57struct _RingClientClass
58{
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -040059 GtkApplicationClass parent_class;
Stepan Salenikovich434b88f2015-02-19 17:49:08 -050060};
61
62struct _RingClient
63{
64 GtkApplication parent;
65};
66
67typedef struct _RingClientPrivate RingClientPrivate;
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050068
69struct _RingClientPrivate {
Stepan Salenikovich0d515e52015-05-19 16:31:05 -040070 /* args */
71 int argc;
72 char **argv;
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -040073
74 GSettings *settings;
75
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050076 /* main window */
77 GtkWidget *win;
78 /* for libRingclient */
79 QCoreApplication *qtapp;
Stepan Salenikovich068fb692015-03-23 14:58:32 -040080 /* UAM */
81 QMetaObject::Connection uam_updated;
Stepan Salenikovich6f687072015-03-26 10:43:37 -040082
83 GCancellable *cancellable;
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050084};
85
Stepan Salenikovich0d515e52015-05-19 16:31:05 -040086/* this union is used to pass ints as pointers and vice versa for GAction parameters*/
87typedef union _int_ptr_t
88{
89 int value;
90 gint64 value64;
91 gpointer ptr;
92} int_ptr_t;
93
Stepan Salenikovich434b88f2015-02-19 17:49:08 -050094G_DEFINE_TYPE_WITH_PRIVATE(RingClient, ring_client, GTK_TYPE_APPLICATION);
Stepan Salenikovichd81ef292015-02-17 18:47:37 -050095
96#define RING_CLIENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RING_CLIENT_TYPE, RingClientPrivate))
97
98static void
99init_exception_dialog(const char* msg)
100{
101 g_warning("%s", msg);
102 GtkWidget *dialog = gtk_message_dialog_new(NULL,
103 (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
104 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
105 _("Unable to initialize.\nMake sure the Ring daemon (dring) is running.\nError: %s"),
106 msg);
107
108 gtk_window_set_title(GTK_WINDOW(dialog), _("Ring Error"));
109 gtk_dialog_run(GTK_DIALOG(dialog));
110 gtk_widget_destroy(dialog);
111}
112
Stepan Salenikovich2d63d5e2015-03-22 23:23:54 -0400113static void
114ring_accelerators(RingClient *client)
115{
Stepan Salenikovich39ee49a2015-03-24 12:44:55 -0400116#if GTK_CHECK_VERSION(3,12,0)
Stepan Salenikovich2d63d5e2015-03-22 23:23:54 -0400117 const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
118 gtk_application_set_accels_for_action(GTK_APPLICATION(client), "app.quit", quit_accels);
119#else
120 gtk_application_add_accelerator(GTK_APPLICATION(client), "<Control>Q", "win.quit", NULL);
121#endif
122}
123
124static void
125action_quit(G_GNUC_UNUSED GSimpleAction *simple,
126 G_GNUC_UNUSED GVariant *parameter,
127 gpointer user_data)
128{
129 g_return_if_fail(G_IS_APPLICATION(user_data));
130
131#if GLIB_CHECK_VERSION(2,32,0)
132 g_application_quit(G_APPLICATION(user_data));
133#else
134 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(user_data);
135 gtk_widget_destroy(priv->win);
136#endif
137}
138
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400139static void
140action_about(G_GNUC_UNUSED GSimpleAction *simple,
141 G_GNUC_UNUSED GVariant *parameter,
142 gpointer user_data)
143{
144 g_return_if_fail(G_IS_APPLICATION(user_data));
145 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(user_data);
146
147 ring_about_dialog(priv->win);
148}
149
Stepan Salenikovich69771842015-02-24 18:11:45 -0500150static const GActionEntry ring_actions[] =
151{
Stepan Salenikovich24dcd5c2015-03-26 17:40:34 -0400152 { "accept", NULL, NULL, NULL, NULL, {0} },
153 { "hangup", NULL, NULL, NULL, NULL, {0} },
154 { "hold", NULL, NULL, "false", NULL, {0} },
155 { "quit", action_quit, NULL, NULL, NULL, {0} },
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400156 { "about", action_about, NULL, NULL, NULL, {0} },
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500157 /* TODO implement the other actions */
158 // { "mute_audio", NULL, NULL, "false", NULL, {0} },
159 // { "mute_video", NULL, NULL, "false", NULL, {0} },
160 // { "transfer", NULL, NULL, "flase", NULL, {0} },
161 // { "record", NULL, NULL, "false", NULL, {0} }
Stepan Salenikovich69771842015-02-24 18:11:45 -0500162};
163
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500164static void
165activate_action(GSimpleAction *action, G_GNUC_UNUSED GVariant *parameter, gpointer user_data)
166{
167 g_debug("activating action: %s", g_action_get_name(G_ACTION(action)));
168
169 int_ptr_t key;
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400170
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500171 key.ptr = user_data;
172 UserActionModel::Action a = static_cast<UserActionModel::Action>(key.value);
173 UserActionModel* uam = CallModel::instance()->userActionModel();
174
175 uam << a;
176}
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500177
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400178static void
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -0400179autostart_toggled(GSettings *settings, G_GNUC_UNUSED gchar *key, G_GNUC_UNUSED gpointer user_data)
180{
181 autostart_symlink(g_settings_get_boolean(settings, "start-on-login"));
182}
183
184static void
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400185ring_client_startup(GApplication *app)
Stepan Salenikovich69771842015-02-24 18:11:45 -0500186{
Stepan Salenikovich69771842015-02-24 18:11:45 -0500187 RingClient *client = RING_CLIENT(app);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400188 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(client);
Stepan Salenikovich69771842015-02-24 18:11:45 -0500189
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -0400190 /* make sure that the system corresponds to the autostart setting */
191 autostart_symlink(g_settings_get_boolean(priv->settings, "start-on-login"));
192 g_signal_connect(priv->settings, "changed::start-on-login", G_CALLBACK(autostart_toggled), NULL);
193
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400194 /* init clutter */
195 int clutter_error;
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400196 if ((clutter_error = gtk_clutter_init(&priv->argc, &priv->argv)) != CLUTTER_INIT_SUCCESS) {
197 g_error("Could not init clutter : %d\n", clutter_error);
198 exit(1); /* the g_error above should normally cause the applicaiton to exit */
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400199 }
200
201 /* init libRingClient and make sure its connected to the dbus */
202 try {
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400203 priv->qtapp = new QCoreApplication(priv->argc, priv->argv);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400204 /* the call model will try to connect to dring via dbus */
205 CallModel::instance();
206 } catch (const char * msg) {
207 init_exception_dialog(msg);
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400208 g_error("%s", msg);
209 exit(1); /* the g_error above should normally cause the applicaiton to exit */
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400210 } catch(QString& msg) {
211 QByteArray ba = msg.toLocal8Bit();
212 const char *c_str = ba.data();
213 init_exception_dialog(c_str);
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400214 g_error("%s", c_str);
215 exit(1); /* the g_error above should normally cause the applicaiton to exit */
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400216 }
217
Stepan Salenikovich6f687072015-03-26 10:43:37 -0400218 /* init delegates */
219 /* FIXME: put in smart pointer? */
220 new PixbufDelegate();
221
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400222 /* add backends */
Stepan Salenikovich1e131a42015-05-27 14:12:21 -0400223 CategorizedHistoryModel::instance()->addCollection<LocalHistoryCollection>(LoadOptions::FORCE_ENABLED);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400224
Stepan Salenikovich6f687072015-03-26 10:43:37 -0400225 PersonModel::instance()->addCollection<FallbackPersonCollection>(LoadOptions::FORCE_ENABLED);
226
227 /* TODO: should a local vcard location be added ?
228 * PersonModel::instance()->addCollection<FallbackPersonCollection, QString>(
229 * QStandardPaths::writableLocation(QStandardPaths::DataLocation)+QLatin1Char('/')+"vcard",
230 * LoadOptions::FORCE_ENABLED);
231 */
232
233 /* EDS backend */
234 load_eds_sources(priv->cancellable);
235
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400236 /* Override theme since we don't have appropriate icons for a dark them (yet) */
237 GtkSettings *gtk_settings = gtk_settings_get_default();
238 g_object_set(G_OBJECT(gtk_settings), "gtk-application-prefer-dark-theme",
239 FALSE, NULL);
240 /* enable button icons */
241 g_object_set(G_OBJECT(gtk_settings), "gtk-button-images",
242 TRUE, NULL);
243
244 /* add GActions */
Stepan Salenikovich69771842015-02-24 18:11:45 -0500245 g_action_map_add_action_entries(
Stepan Salenikovich2d63d5e2015-03-22 23:23:54 -0400246 G_ACTION_MAP(app), ring_actions, G_N_ELEMENTS(ring_actions), app);
247
248 /* add accelerators */
249 ring_accelerators(RING_CLIENT(app));
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500250
Stepan Salenikovich347b73a2015-03-22 10:39:00 -0400251 /* Bind GActions to the UserActionModel */
252 UserActionModel* uam = CallModel::instance()->userActionModel();
253 QHash<int, GSimpleAction*> actionHash;
254 actionHash[ (int)UserActionModel::Action::ACCEPT ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "accept"));
255 actionHash[ (int)UserActionModel::Action::HOLD ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "hold"));
256 /* TODO: add commented actions when ready */
257 // actionHash[ (int)UserActionModel::Action::MUTE_AUDIO ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "mute_audio"));
258 // actionHash[ (int)UserActionModel::Action::SERVER_TRANSFER ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "transfer"));
259 // actionHash[ (int)UserActionModel::Action::RECORD ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "record"));
260 actionHash[ (int)UserActionModel::Action::HANGUP ] = G_SIMPLE_ACTION(g_action_map_lookup_action(G_ACTION_MAP(app), "hangup"));
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500261
Stepan Salenikovich347b73a2015-03-22 10:39:00 -0400262 for (QHash<int,GSimpleAction*>::const_iterator i = actionHash.begin(); i != actionHash.end(); ++i) {
263 GSimpleAction* sa = i.value();
264 int_ptr_t user_data;
265 user_data.value = i.key();
266 g_signal_connect(G_OBJECT(sa), "activate", G_CALLBACK(activate_action), user_data.ptr);
267 }
Stepan Salenikovichc64523b2015-02-27 16:31:00 -0500268
Stepan Salenikovich347b73a2015-03-22 10:39:00 -0400269 /* change the state of the GActions based on the UserActionModel */
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400270 priv->uam_updated = QObject::connect(uam,&UserActionModel::dataChanged, [actionHash,uam](const QModelIndex& tl, const QModelIndex& br) {
Stepan Salenikovich347b73a2015-03-22 10:39:00 -0400271 const int first(tl.row()),last(br.row());
272 for(int i = first; i <= last;i++) {
273 const QModelIndex& idx = uam->index(i,0);
274 GSimpleAction* sa = actionHash[(int)qvariant_cast<UserActionModel::Action>(idx.data(UserActionModel::Role::ACTION))];
275 if (sa) {
276 /* enable/disable GAction based on UserActionModel */
277 g_simple_action_set_enabled(sa, idx.flags() & Qt::ItemIsEnabled);
278 /* set the state of the action if its stateful */
279 if (g_action_get_state_type(G_ACTION(sa)) != NULL)
280 g_simple_action_set_state(sa, g_variant_new_boolean(idx.data(Qt::CheckStateRole) == Qt::Checked));
281 }
282 }
283 });
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400284
Stepan Salenikovich76c33e62015-05-22 12:24:07 -0400285 /* send call notifications */
286 ring_notify_init();
287 QObject::connect(CallModel::instance(), &CallModel::incomingCall,
288 [=] (Call *call) { ring_notify_incoming_call(call);}
289 );
290
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400291#if GLIB_CHECK_VERSION(2,40,0)
292 G_APPLICATION_CLASS(ring_client_parent_class)->startup(app);
293#else
294 /* don't need to chain up to the parent callback as this function will
295 * be called manually by the command_line callback in this case */
296#endif
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400297}
298
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400299#if !GLIB_CHECK_VERSION(2,40,0)
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400300static int
301ring_client_command_line(GApplication *app, GApplicationCommandLine *cmdline)
302{
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400303 gint argc;
304 gchar **argv = g_application_command_line_get_arguments(cmdline, &argc);
305 GOptionContext *context = ring_client_options_get_context();
306 GError *error = NULL;
307 if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
308 g_print(_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
309 error->message, argv[0]);
Stepan Salenikovich8a287fc2015-05-01 16:53:20 -0400310 g_clear_error(&error);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400311 g_option_context_free(context);
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400312 g_strfreev(argv);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400313 return 1;
314 }
315 g_option_context_free(context);
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400316 g_strfreev(argv);
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400317
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400318 if (!g_application_get_is_remote(app)) {
319 /* if this is the primary instance, we must peform the startup */
320 ring_client_startup(app);
321 }
322
323 g_application_activate(app);
324
325 return 0;
326}
327#endif
328
329static void
330ring_client_activate(GApplication *app)
331{
332 RingClient *client = RING_CLIENT(app);
333 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(client);
334
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400335 if (priv->win == NULL) {
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400336 priv->win = ring_main_window_new(GTK_APPLICATION(app));
337 }
338
339 gtk_window_present(GTK_WINDOW(priv->win));
Stepan Salenikovich69771842015-02-24 18:11:45 -0500340}
341
342static void
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500343ring_client_shutdown(GApplication *app)
344{
345 RingClient *self = RING_CLIENT(app);
346 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(self);
347
Stepan Salenikovich2d63d5e2015-03-22 23:23:54 -0400348 g_debug("quitting");
349
Stepan Salenikovich6f687072015-03-26 10:43:37 -0400350 /* cancel any pending cancellable operations */
351 g_cancellable_cancel(priv->cancellable);
352 g_object_unref(priv->cancellable);
353
Stepan Salenikovich068fb692015-03-23 14:58:32 -0400354 QObject::disconnect(priv->uam_updated);
355
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500356 /* free the QCoreApplication, which will destroy all libRingClient models
357 * and thus send the Unregister signal over dbus to dring */
358 delete priv->qtapp;
359
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400360 /* free the copied cmd line args */
361 g_strfreev(priv->argv);
362
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -0400363 g_clear_object(&priv->settings);
364
Stepan Salenikovich76c33e62015-05-22 12:24:07 -0400365 ring_notify_uninit();
366
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500367 /* Chain up to the parent class */
368 G_APPLICATION_CLASS(ring_client_parent_class)->shutdown(app);
369}
370
371static void
372ring_client_init(RingClient *self)
373{
374 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(self);
375
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500376 priv->win = NULL;
377 priv->qtapp = NULL;
Stepan Salenikovich6f687072015-03-26 10:43:37 -0400378 priv->cancellable = g_cancellable_new();
Stepan Salenikovichfb7f2952015-05-25 16:44:19 -0400379 priv->settings = g_settings_new_full(get_ring_schema(), NULL, NULL);
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400380
381#if GLIB_CHECK_VERSION(2,40,0)
382 /* add custom cmd line options */
383 ring_client_add_options(G_APPLICATION(self));
384#endif
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500385}
386
387static void
388ring_client_class_init(RingClientClass *klass)
389{
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400390#if GLIB_CHECK_VERSION(2,40,0)
391 G_APPLICATION_CLASS(klass)->startup = ring_client_startup;
392#else
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500393 G_APPLICATION_CLASS(klass)->command_line = ring_client_command_line;
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400394#endif
395 G_APPLICATION_CLASS(klass)->activate = ring_client_activate;
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500396 G_APPLICATION_CLASS(klass)->shutdown = ring_client_shutdown;
397}
398
399RingClient *
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400400ring_client_new(int argc, char *argv[])
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500401{
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400402 /* because the g_application_add_main_option_entries was only added in
403 * glib 2.40, for lower versions we must handle the command line options
404 * ourselves
405 */
406 RingClient *client = (RingClient *)g_object_new(ring_client_get_type(),
Stepan Salenikovich76350582015-05-25 14:56:32 -0400407 "application-id", RING_CLIENT_APP_ID,
Stepan Salenikovich0d515e52015-05-19 16:31:05 -0400408#if GLIB_CHECK_VERSION(2,40,0)
409 NULL);
410#else
411 "flags", G_APPLICATION_HANDLES_COMMAND_LINE,
412 NULL);
413#endif
414
415 /* copy the cmd line args before they get processed by the GApplication*/
416 RingClientPrivate *priv = RING_CLIENT_GET_PRIVATE(client);
417 priv->argc = argc;
418 priv->argv = g_strdupv((gchar **)argv);
419
420 return client;
Stepan Salenikovichd81ef292015-02-17 18:47:37 -0500421}