~ubuntu-branches/ubuntu/precise/empathy/precise-proposed-201205180810

« back to all changes in this revision

Viewing changes to src/empathy-accounts-dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-06-01 10:35:24 UTC
  • mfrom: (1.1.70 upstream) (6.3.44 experimental)
  • Revision ID: james.westby@ubuntu.com-20110601103524-wx3wgp71394730jt
Tags: 3.1.1-1ubuntu1
[ Brian Curtis ]
* Merge with Debian experimental, remaining Ubuntu changes:
* debian/control:
  - Drop geoclue/mapping build-depends (they are in Universe)
  - Add Vcz-Bzr link
  - Add Suggests on telepathy-idle
  - Bump telepathy-butterfly, telepathy-haze to recommends
  - Don't recommend the freedesktop sound theme we have an ubuntu one
  - Add build depend for libunity-dev
* debian/rules:
  - Use autoreconf.mk
  - Disable map and location
* debian/empathy.install:
  - Install message indicator configuration
* debian/indicators/empathy:
  - Message indicator configuration
* debian/patches/01_lpi.patch:
  - Add Launchpad integration
* debian/patches/10_use_notify_osd_icons.patch:
  - Use the notify-osd image for new messages
* debian/patches/34_start_raised_execpt_in_session.patch
  - If not started with the session, we should always raise
* debian/patches/36_chat_window_default_size.patch:
  - Make the default chat window size larger
* debian/patches/37_facebook_default.patch:
  - Make facebook the default chat account type
* debian/patches/38_lp_569289.patch
  - Set freenode as default IRC network for new IRC accounts 
* debian/patches/41_unity_launcher_progress.patch
  - Display file transfer progress in the unity launcher

[ Ken VanDine ]
* debian/control
  - build depend on libgcr-3-dev instead of libgcr-dev
  - dropped build depends for libindicate, we will use telepathy-indicator
  - Depend on dconf-gsettings-backend | gsettings-backend
  - Added a Recommends for telepathy-indicator
* +debian/empathy.gsettings-override
  - Added an override for notifications-focus
* debian/patches/series
  - commented out 23_idomessagedialog_for_voip_and_ft.patch, until ido has 
    been ported to gtk3

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <libempathy/empathy-utils.h>
40
40
#include <libempathy/empathy-connection-managers.h>
41
41
#include <libempathy/empathy-connectivity.h>
42
 
#include <libempathy/empathy-gsettings.h>
43
42
 
44
43
#include <libempathy-gtk/empathy-ui-utils.h>
45
44
#include <libempathy-gtk/empathy-protocol-chooser.h>
48
47
#include <libempathy-gtk/empathy-account-widget-sip.h>
49
48
#include <libempathy-gtk/empathy-cell-renderer-activatable.h>
50
49
#include <libempathy-gtk/empathy-images.h>
51
 
#include <libempathy-gtk/mx-gtk-light-switch.h>
52
50
 
53
51
#include "empathy-accounts-dialog.h"
54
52
#include "empathy-import-dialog.h"
242
240
}
243
241
 
244
242
static void
245
 
accounts_dialog_enable_switch_flipped (MxGtkLightSwitch *sw,
246
 
    gboolean state,
 
243
accounts_dialog_enable_switch_active_cb (GtkSwitch *sw,
 
244
    GParamSpec *spec,
247
245
    EmpathyAccountsDialog *dialog)
248
246
{
249
247
  EmpathyAccountSettings *settings;
257
255
  if (account == NULL)
258
256
    return;
259
257
 
260
 
  tp_account_set_enabled_async (account, state,
 
258
  tp_account_set_enabled_async (account, gtk_switch_get_active (sw),
261
259
      accounts_dialog_enable_account_cb, NULL);
262
260
}
263
261
 
277
275
  TpAccount                 *selected_account;
278
276
  gboolean                  account_enabled;
279
277
  gboolean                  creating_account;
 
278
  TpStorageRestrictionFlags storage_restrictions = 0;
280
279
 
281
280
  view = GTK_TREE_VIEW (priv->treeview);
282
281
  selection = gtk_tree_view_get_selection (view);
311
310
       * (else no icon is shown in infobar)*/
312
311
      if (!account_enabled)
313
312
        presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
 
313
 
 
314
      storage_restrictions = tp_account_get_storage_restrictions (account);
314
315
    }
315
316
  else
316
317
    {
325
326
 
326
327
  /* update the enabled switch */
327
328
  g_signal_handlers_block_by_func (priv->enabled_switch,
328
 
      accounts_dialog_enable_switch_flipped, dialog);
329
 
  mx_gtk_light_switch_set_active (MX_GTK_LIGHT_SWITCH (priv->enabled_switch),
 
329
      accounts_dialog_enable_switch_active_cb, dialog);
 
330
  gtk_switch_set_active (GTK_SWITCH (priv->enabled_switch),
330
331
      account_enabled);
331
332
  g_signal_handlers_unblock_by_func (priv->enabled_switch,
332
 
      accounts_dialog_enable_switch_flipped, dialog);
 
333
      accounts_dialog_enable_switch_active_cb, dialog);
333
334
 
334
 
  /* inform the account widget */
335
 
  g_object_set (priv->setting_widget_object,
336
 
      "enabled", account_enabled,
337
 
      NULL);
 
335
  /* Display the Enable switch if account supports it */
 
336
  gtk_widget_set_visible (priv->enabled_switch,
 
337
      !(storage_restrictions & TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED));
338
338
 
339
339
  if (account_enabled)
340
340
    {
655
655
{
656
656
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
657
657
  EmpathyAccountSettings *settings;
658
 
  gchar *str;
659
 
  const gchar *name, *display_name;
660
 
  TpConnectionManager *cm;
661
 
  TpConnectionManagerProtocol *proto;
662
 
  gboolean is_gtalk, is_facebook;
663
658
 
664
 
  cm = empathy_protocol_chooser_dup_selected (
665
 
      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk,
666
 
      &is_facebook);
667
 
  if (cm == NULL)
 
659
  settings = empathy_protocol_chooser_create_account_settings (
 
660
      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol));
 
661
  if (settings == NULL)
668
662
    return;
669
663
 
670
 
  if (is_gtalk)
671
 
    name = "gtalk";
672
 
  else if (is_facebook)
673
 
    name ="facebook";
674
 
  else
675
 
    name = proto->name;
676
 
 
677
 
  display_name = empathy_protocol_name_to_display_name (name);
678
 
  if (display_name == NULL)
679
 
    display_name = proto->name;
680
 
 
681
 
  /* Create account */
682
 
  /* To translator: %s is the name of the protocol, such as "Google Talk" or
683
 
   * "Yahoo!"
684
 
   */
685
 
  str = g_strdup_printf (_("New %s account"), display_name);
686
 
  settings = empathy_account_settings_new (cm->name, proto->name, str);
687
 
 
688
 
  g_free (str);
689
 
 
690
 
  if (is_gtalk)
691
 
    {
692
 
      gchar *fallback_servers[] = {
693
 
          "talkx.l.google.com",
694
 
          "talkx.l.google.com:443,oldssl",
695
 
          "talkx.l.google.com:80",
696
 
          NULL};
697
 
 
698
 
      gchar *extra_certificate_identities[] = {
699
 
          "talk.google.com",
700
 
          NULL};
701
 
 
702
 
      empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
703
 
          NULL, NULL);
704
 
 
705
 
      empathy_account_settings_set_strv (settings, "fallback-servers",
706
 
          fallback_servers);
707
 
 
708
 
      if (empathy_account_settings_have_tp_param (settings,
709
 
              "extra-certificate-identities"))
710
 
        {
711
 
          empathy_account_settings_set_strv (settings,
712
 
                  "extra-certificate-identities", extra_certificate_identities);
713
 
        }
714
 
    }
715
 
  else if (is_facebook)
716
 
    {
717
 
      empathy_account_settings_set_icon_name_async (settings, "im-facebook",
718
 
          NULL, NULL);
719
 
 
720
 
      empathy_account_settings_set_string (settings, "server",
721
 
          "chat.facebook.com");
722
 
    }
723
 
 
724
664
  accounts_dialog_add (dialog, settings);
725
665
  accounts_dialog_model_set_selected (dialog, settings);
726
666
 
727
667
  gtk_widget_show_all (priv->hbox_protocol);
728
668
 
729
669
  g_object_unref (settings);
730
 
  g_object_unref (cm);
731
670
}
732
671
 
733
672
static void
1270
1209
{
1271
1210
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1272
1211
  GtkTreeView  *view;
1273
 
  GtkTreeModel *model;
1274
1212
  GtkTreeSelection *selection;
1275
1213
  GtkTreeIter iter;
1276
1214
 
1277
1215
  view = GTK_TREE_VIEW (priv->treeview);
1278
 
  model = gtk_tree_view_get_model (view);
1279
1216
  selection = gtk_tree_view_get_selection (view);
1280
1217
  if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
1281
1218
      return;
1552
1489
    GtkTreeIter *iter)
1553
1490
{
1554
1491
  GtkTreeView      *view;
1555
 
  GtkTreeSelection *selection;
1556
1492
  GtkTreeModel     *model;
1557
1493
  gboolean          ok;
1558
1494
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1559
1495
 
1560
1496
  /* Update the status in the model */
1561
1497
  view = GTK_TREE_VIEW (priv->treeview);
1562
 
  selection = gtk_tree_view_get_selection (view);
1563
1498
  model = gtk_tree_view_get_model (view);
1564
1499
 
1565
1500
  for (ok = gtk_tree_model_get_iter_first (model, iter);
1589
1524
    GtkTreeIter *iter)
1590
1525
{
1591
1526
  GtkTreeView      *view;
1592
 
  GtkTreeSelection *selection;
1593
1527
  GtkTreeModel     *model;
1594
1528
  gboolean          ok;
1595
1529
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1596
1530
 
1597
1531
  /* Update the status in the model */
1598
1532
  view = GTK_TREE_VIEW (priv->treeview);
1599
 
  selection = gtk_tree_view_get_selection (view);
1600
1533
  model = gtk_tree_view_get_model (view);
1601
1534
 
1602
1535
  for (ok = gtk_tree_model_get_iter_first (model, iter);
1646
1579
accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog,
1647
1580
    EmpathyAccountSettings *settings)
1648
1581
{
1649
 
  GtkTreeSelection *selection;
1650
1582
  GtkTreeIter       iter;
1651
 
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1652
1583
 
1653
 
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
1654
1584
  if (accounts_dialog_get_settings_iter (dialog, settings, &iter))
1655
1585
    select_and_scroll_to_iter (dialog, &iter);
1656
1586
}
 
1587
 
 
1588
static void
 
1589
accounts_dialog_treeview_enabled_cb (GtkMenuItem *item,
 
1590
    TpAccount *account)
 
1591
{
 
1592
  gboolean enabled;
 
1593
 
 
1594
  enabled = tp_account_is_enabled (account);
 
1595
  tp_account_set_enabled_async (account, !enabled, NULL, NULL);
 
1596
}
 
1597
 
 
1598
static gboolean
 
1599
accounts_dialog_treeview_button_press_event_cb (GtkTreeView *view,
 
1600
    GdkEventButton *event,
 
1601
    EmpathyAccountsDialog *dialog)
 
1602
{
 
1603
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
1604
  TpAccount *account = NULL;
 
1605
  GtkTreeModel *model = NULL;
 
1606
  GtkTreePath *path = NULL;
 
1607
  GtkTreeIter iter;
 
1608
  GtkWidget *menu;
 
1609
  GtkWidget *item_enable, *item_disable;
 
1610
  GtkWidget *image_enable, *image_disable;
 
1611
 
 
1612
  /* ignore multiple clicks */
 
1613
  if (event->type != GDK_BUTTON_PRESS)
 
1614
    return TRUE;
 
1615
 
 
1616
  if (event->button != 3)
 
1617
    goto finally;
 
1618
 
 
1619
  /* Selection is not yet set, so we have to get account from event position */
 
1620
  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
 
1621
  if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->treeview),
 
1622
      event->x, event->y, &path, NULL, NULL, NULL))
 
1623
    goto finally;
 
1624
 
 
1625
  if (!gtk_tree_model_get_iter (model, &iter, path))
 
1626
    goto finally;
 
1627
 
 
1628
  gtk_tree_model_get (model, &iter, COL_ACCOUNT, &account, -1);
 
1629
 
 
1630
  /* Create the menu */
 
1631
  menu = empathy_context_menu_new (GTK_WIDGET (view));
 
1632
 
 
1633
  /* Get images for menu items */
 
1634
  image_enable = gtk_image_new_from_icon_name (empathy_icon_name_for_presence (
 
1635
        tp_account_manager_get_most_available_presence (
 
1636
          priv->account_manager, NULL, NULL)),
 
1637
      GTK_ICON_SIZE_MENU);
 
1638
  image_disable = gtk_image_new_from_icon_name (
 
1639
      empathy_icon_name_for_presence (TP_CONNECTION_PRESENCE_TYPE_OFFLINE),
 
1640
      GTK_ICON_SIZE_MENU);
 
1641
 
 
1642
  /* Menu items: to enabled/disable the account */
 
1643
  item_enable = gtk_image_menu_item_new_with_mnemonic (_("_Enable"));
 
1644
  item_disable = gtk_image_menu_item_new_with_mnemonic (_("_Disable"));
 
1645
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_enable),
 
1646
      image_enable);
 
1647
  gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item_disable),
 
1648
      image_disable);
 
1649
 
 
1650
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_enable);
 
1651
  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_disable);
 
1652
 
 
1653
  if (tp_account_is_enabled (account))
 
1654
    {
 
1655
      tp_g_signal_connect_object (item_disable, "activate",
 
1656
          G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0);
 
1657
      gtk_widget_set_sensitive (item_enable, FALSE);
 
1658
    }
 
1659
  else
 
1660
    {
 
1661
      tp_g_signal_connect_object (item_enable, "activate",
 
1662
          G_CALLBACK (accounts_dialog_treeview_enabled_cb), account, 0);
 
1663
      gtk_widget_set_sensitive (item_disable, FALSE);
 
1664
    }
 
1665
 
 
1666
  gtk_widget_show (item_enable);
 
1667
  gtk_widget_show (item_disable);
 
1668
 
 
1669
  /* FIXME: Add here presence items, to be able to set per-account presence */
 
1670
 
 
1671
  /* Popup menu */
 
1672
  gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
 
1673
      event->button, event->time);
 
1674
 
 
1675
finally:
 
1676
  tp_clear_object (&account);
 
1677
  gtk_tree_path_free (path);
 
1678
 
 
1679
  return FALSE;
 
1680
}
 
1681
 
1657
1682
static void
1658
1683
accounts_dialog_add (EmpathyAccountsDialog *dialog,
1659
1684
    EmpathyAccountSettings *settings)
1797
1822
  GtkTreeIter         iter;
1798
1823
  TpConnectionStatus  status;
1799
1824
  const gchar        *name;
1800
 
  gboolean            enabled;
1801
1825
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1802
1826
  gboolean selected = FALSE;
1803
1827
 
1804
1828
  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
1805
1829
  status = tp_account_get_connection_status (account, NULL);
1806
1830
  name = tp_account_get_display_name (account);
1807
 
  enabled = tp_account_is_enabled (account);
1808
1831
 
1809
1832
  settings = empathy_account_settings_new_for_account (account);
1810
1833
 
1934
1957
    TpAccount *account,
1935
1958
    gboolean enabled)
1936
1959
{
1937
 
  GtkTreeModel *model;
1938
 
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
1939
 
 
1940
 
  /* Update the status in the model */
1941
 
  model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
1942
 
 
1943
1960
  /* Update the status-infobar in the details view */
1944
1961
  accounts_dialog_update_status_infobar (dialog, account);
1945
1962
 
2002
2019
accounts_dialog_set_selected_account (EmpathyAccountsDialog *dialog,
2003
2020
    TpAccount *account)
2004
2021
{
2005
 
  GtkTreeSelection *selection;
2006
2022
  GtkTreeIter       iter;
2007
 
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
2008
2023
 
2009
 
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
2010
2024
  if (accounts_dialog_get_account_iter (dialog, account, &iter))
2011
2025
    select_and_scroll_to_iter (dialog, &iter);
2012
2026
}
2046
2060
  if (!empathy_connection_managers_prepare_finish (cms, result, NULL))
2047
2061
    goto out;
2048
2062
 
2049
 
  accounts_dialog_update_settings (dialog, NULL);
 
2063
  /* No need to update the settings if we are already preparing one */
 
2064
  if (priv->settings_ready == NULL)
 
2065
    accounts_dialog_update_settings (dialog, NULL);
2050
2066
 
2051
2067
  if (priv->initial_selection != NULL)
2052
2068
    {
2189
2205
      "button_add", "clicked", accounts_dialog_button_add_clicked_cb,
2190
2206
      "button_remove", "clicked", accounts_dialog_button_remove_clicked_cb,
2191
2207
      "button_import", "clicked", accounts_dialog_button_import_clicked_cb,
 
2208
      "treeview", "button-press-event",
 
2209
         accounts_dialog_treeview_button_press_event_cb,
2192
2210
      NULL);
2193
2211
 
2194
2212
  content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
2195
2213
 
2196
 
  gtk_container_add (GTK_CONTAINER (content_area), top_hbox);
 
2214
  gtk_box_pack_start (GTK_BOX (content_area), top_hbox, TRUE, TRUE, 0);
2197
2215
 
2198
2216
  g_object_unref (gui);
2199
2217
 
2292
2310
  align = gtk_alignment_new (0.5, 0.5, 1., 0.);
2293
2311
  gtk_box_pack_start (GTK_BOX (content_area), align, FALSE, TRUE, 0);
2294
2312
 
2295
 
  priv->enabled_switch = mx_gtk_light_switch_new ();
 
2313
  priv->enabled_switch = gtk_switch_new ();
2296
2314
  gtk_container_add (GTK_CONTAINER (align), priv->enabled_switch);
2297
 
  g_signal_connect (priv->enabled_switch, "switch-flipped",
2298
 
      G_CALLBACK (accounts_dialog_enable_switch_flipped), dialog);
 
2315
  g_signal_connect (priv->enabled_switch, "notify::active",
 
2316
      G_CALLBACK (accounts_dialog_enable_switch_active_cb), dialog);
2299
2317
  gtk_widget_show_all (align);
2300
2318
 
2301
2319
  /* Tweak the dialog */
2402
2420
  EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (object);
2403
2421
  EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
2404
2422
  GtkTreeModel *model;
2405
 
  GSettings *gsettings = g_settings_new (EMPATHY_PREFS_SCHEMA);
2406
2423
 
2407
2424
  accounts_dialog_build_ui (dialog);
2408
2425
  accounts_dialog_model_setup (dialog);
2419
2436
  tp_account_manager_prepare_async (priv->account_manager, NULL,
2420
2437
      accounts_dialog_manager_ready_cb, dialog);
2421
2438
 
2422
 
  if (empathy_import_accounts_to_import ())
2423
 
    {
2424
 
      gtk_widget_show (priv->button_import);
2425
 
 
2426
 
      if (!g_settings_get_boolean (gsettings, EMPATHY_PREFS_IMPORT_ASKED))
2427
 
        {
2428
 
          GtkWidget *import_dialog;
2429
 
 
2430
 
          g_settings_set_boolean (gsettings, EMPATHY_PREFS_IMPORT_ASKED, TRUE);
2431
 
          import_dialog = empathy_import_dialog_new (GTK_WINDOW (dialog),
2432
 
              FALSE);
2433
 
          gtk_widget_show (import_dialog);
2434
 
        }
2435
 
    }
2436
 
 
2437
2439
  priv->connectivity = empathy_connectivity_dup_singleton ();
2438
 
 
2439
 
  g_object_unref (gsettings);
2440
2440
}
2441
2441
 
2442
2442
static void
2507
2507
    gboolean hidden)
2508
2508
{
2509
2509
  GError *error = NULL;
2510
 
  const gchar *argv[4] = { NULL, };
2511
 
  gint i = 0;
2512
 
  gchar *account_option = NULL;
 
2510
  GdkDisplay *display;
 
2511
  GString *cmd;
2513
2512
  gchar *path;
 
2513
  GAppInfo *app_info;
 
2514
  GdkAppLaunchContext *context = NULL;
2514
2515
 
2515
2516
  g_return_if_fail (GDK_IS_SCREEN (screen));
2516
2517
  g_return_if_fail (!selected_account || TP_IS_ACCOUNT (selected_account));
2525
2526
      path = g_build_filename (BIN_DIR, "empathy-accounts", NULL);
2526
2527
    }
2527
2528
 
2528
 
  argv[i++] = path;
 
2529
  cmd = g_string_new (path);
 
2530
  g_free (path);
2529
2531
 
2530
2532
  if (selected_account != NULL)
2531
2533
    {
2532
 
      const gchar *account_path;
2533
 
 
2534
 
      account_path = tp_proxy_get_object_path (TP_PROXY (selected_account));
2535
 
      account_option = g_strdup_printf ("--select-account=%s",
2536
 
          &account_path[strlen (TP_ACCOUNT_OBJECT_PATH_BASE)]);
2537
 
 
2538
 
      argv[i++] = account_option;
 
2534
      g_string_append_printf (cmd, " --select-account=%s",
 
2535
          tp_account_get_path_suffix (selected_account));
2539
2536
    }
2540
2537
 
2541
2538
  if (if_needed)
2542
 
    argv[i++] = "--if-needed";
 
2539
    g_string_append_printf (cmd, " --if-needed");
2543
2540
 
2544
2541
  if (hidden)
2545
 
    argv[i++] = "--hidden";
 
2542
    g_string_append_printf (cmd, " --hidden");
2546
2543
 
2547
2544
  DEBUG ("Launching empathy-accounts (if_needed: %d, hidden: %d, account: %s)",
2548
2545
    if_needed, hidden,
2549
2546
    selected_account == NULL ? "<none selected>" :
2550
2547
      tp_proxy_get_object_path (TP_PROXY (selected_account)));
2551
2548
 
2552
 
  gdk_spawn_on_screen (screen, NULL, (gchar**) argv, NULL, G_SPAWN_SEARCH_PATH,
2553
 
      NULL, NULL, NULL, &error);
2554
 
  if (error != NULL)
 
2549
  app_info = g_app_info_create_from_commandline (cmd->str, NULL, 0, &error);
 
2550
  if (app_info == NULL)
 
2551
    {
 
2552
      DEBUG ("Failed to create app info: %s", error->message);
 
2553
      g_error_free (error);
 
2554
      goto out;
 
2555
    }
 
2556
 
 
2557
  display = gdk_screen_get_display (screen);
 
2558
  context = gdk_display_get_app_launch_context (display);
 
2559
 
 
2560
  if (!g_app_info_launch (app_info, NULL, (GAppLaunchContext *) context,
 
2561
        &error))
2555
2562
    {
2556
2563
      g_warning ("Failed to open accounts dialog: %s", error->message);
2557
2564
      g_error_free (error);
2558
2565
    }
2559
2566
 
2560
 
  g_free (account_option);
2561
 
  g_free (path);
 
2567
out:
 
2568
  tp_clear_object (&app_info);
 
2569
  tp_clear_object (&context);
 
2570
  g_string_free (cmd, TRUE);
2562
2571
}
2563
2572
 
2564
2573
gboolean