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

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-protocol-chooser.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:
77
77
  COL_LABEL,
78
78
  COL_CM,
79
79
  COL_PROTOCOL_NAME,
80
 
  COL_IS_GTALK,
81
 
  COL_IS_FACEBOOK,
 
80
  COL_SERVICE,
82
81
  COL_COUNT
83
82
};
84
83
 
90
89
{
91
90
  guint i;
92
91
  const gchar *names[] = {
 
92
    "facebook",
93
93
    "jabber",
94
94
    "local-xmpp",
95
95
    "gtalk",
131
131
       * non-gtalk */
132
132
      if (cmp == 0)
133
133
        {
134
 
          gboolean is_gtalk, is_facebook;
 
134
          gchar *service;
 
135
 
135
136
          gtk_tree_model_get (model, iter_a,
136
 
            COL_IS_GTALK, &is_gtalk,
137
 
            COL_IS_FACEBOOK, &is_facebook,
 
137
            COL_SERVICE, &service,
138
138
            -1);
139
139
 
140
 
          if (is_facebook)
 
140
          if (service != NULL)
 
141
            cmp = 1;
 
142
          else
141
143
            cmp = -1;
142
 
          else
143
 
            cmp = 1;
 
144
 
 
145
          g_free (service);
144
146
        }
145
147
    }
146
148
 
224
226
          g_strdup (proto->name), g_strdup (cm->name));
225
227
 
226
228
      icon_name = empathy_protocol_icon_name (proto->name);
 
229
 
227
230
      display_name = empathy_protocol_name_to_display_name (proto->name);
228
231
 
229
 
      if (display_name == NULL)
230
 
        display_name = proto->name;
231
 
 
232
232
      gtk_list_store_insert_with_values (priv->store,
233
233
          NULL, 0,
234
234
          COL_ICON, icon_name,
235
235
          COL_LABEL, display_name,
236
236
          COL_CM, cm,
237
237
          COL_PROTOCOL_NAME, proto->name,
238
 
          COL_IS_GTALK, FALSE,
239
 
          COL_IS_FACEBOOK, FALSE,
240
238
          -1);
241
239
 
242
240
      if (!tp_strdiff (proto->name, "jabber") &&
243
241
          !tp_strdiff (cm->name, "gabble"))
244
242
        {
245
 
          display_name = empathy_protocol_name_to_display_name ("gtalk");
 
243
          display_name = empathy_service_name_to_display_name ("google-talk");
246
244
          gtk_list_store_insert_with_values (priv->store,
247
245
             NULL, 0,
248
246
             COL_ICON, "im-google-talk",
249
247
             COL_LABEL, display_name,
250
248
             COL_CM, cm,
251
249
             COL_PROTOCOL_NAME, proto->name,
252
 
             COL_IS_GTALK, TRUE,
253
 
             COL_IS_FACEBOOK, FALSE,
 
250
             COL_SERVICE, "google-talk",
254
251
             -1);
255
252
 
256
 
          display_name = empathy_protocol_name_to_display_name ("facebook");
 
253
          display_name = empathy_service_name_to_display_name ("facebook");
257
254
          gtk_list_store_insert_with_values (priv->store,
258
255
             NULL, 0,
259
256
             COL_ICON, "im-facebook",
260
257
             COL_LABEL, display_name,
261
258
             COL_CM, cm,
262
259
             COL_PROTOCOL_NAME, proto->name,
263
 
             COL_IS_GTALK, FALSE,
264
 
             COL_IS_FACEBOOK, TRUE,
 
260
             COL_SERVICE, "facebook",
265
261
             -1);
266
262
        }
267
263
 
312
308
          G_TYPE_STRING,    /* Label     */
313
309
          G_TYPE_OBJECT,    /* CM */
314
310
          G_TYPE_STRING,    /* protocol name  */
315
 
          G_TYPE_BOOLEAN,   /* is gtalk  */
316
 
          G_TYPE_BOOLEAN);  /* is facebook  */
 
311
          G_TYPE_STRING);   /* service */
317
312
 
318
313
  /* Set the protocol sort function */
319
314
  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
426
421
  TpConnectionManager *cm = NULL;
427
422
  gchar *protocol_name = NULL;
428
423
  gboolean visible = FALSE;
429
 
  gboolean is_gtalk, is_facebook;
 
424
  gchar *service;
430
425
 
431
426
  gtk_tree_model_get (model, iter,
432
427
      COL_CM, &cm,
433
428
      COL_PROTOCOL_NAME, &protocol_name,
434
 
      COL_IS_GTALK, &is_gtalk,
435
 
      COL_IS_FACEBOOK, &is_facebook,
 
429
      COL_SERVICE, &service,
436
430
      -1);
437
431
 
438
432
  if (cm != NULL && protocol_name != NULL)
444
438
 
445
439
      if (protocol != NULL)
446
440
        {
447
 
          visible = priv->filter_func (cm, protocol, is_gtalk, is_facebook,
 
441
          visible = priv->filter_func (cm, protocol, service,
448
442
              priv->filter_user_data);
449
443
        }
450
444
    }
452
446
  if (cm != NULL)
453
447
    g_object_unref (cm);
454
448
 
 
449
  g_free (service);
455
450
  return visible;
456
451
}
457
452
 
470
465
empathy_protocol_chooser_dup_selected (
471
466
    EmpathyProtocolChooser *protocol_chooser,
472
467
    TpConnectionManagerProtocol **protocol,
473
 
    gboolean *is_gtalk,
474
 
    gboolean *is_facebook)
 
468
    gchar **service)
475
469
{
476
470
  GtkTreeIter iter;
477
471
  TpConnectionManager *cm = NULL;
512
506
            }
513
507
        }
514
508
 
515
 
      if (is_gtalk != NULL)
516
 
        {
517
 
          gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
518
 
              COL_IS_GTALK, is_gtalk,
519
 
              -1);
520
 
        }
521
 
 
522
 
      if (is_facebook != NULL)
523
 
        {
524
 
          gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
525
 
              COL_IS_FACEBOOK, is_facebook,
 
509
      if (service != NULL)
 
510
        {
 
511
          gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
 
512
              COL_SERVICE, service,
526
513
              -1);
527
514
        }
528
515
    }
571
558
 
572
559
  gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0);
573
560
}
 
561
 
 
562
EmpathyAccountSettings *
 
563
empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self)
 
564
{
 
565
  EmpathyAccountSettings *settings = NULL;
 
566
  gchar *str;
 
567
  const gchar *display_name;
 
568
  TpConnectionManager *cm;
 
569
  TpConnectionManagerProtocol *proto;
 
570
  gchar *service = NULL;
 
571
 
 
572
  cm = empathy_protocol_chooser_dup_selected (self, &proto, &service);
 
573
  if (cm == NULL || proto == NULL)
 
574
    goto out;
 
575
 
 
576
  if (service != NULL)
 
577
    display_name = empathy_service_name_to_display_name (service);
 
578
  else
 
579
    display_name = empathy_protocol_name_to_display_name (proto->name);
 
580
 
 
581
  /* Create account */
 
582
  /* To translator: %s is the name of the protocol, such as "Google Talk" or
 
583
   * "Yahoo!"
 
584
   */
 
585
  str = g_strdup_printf (_("New %s account"), display_name);
 
586
  settings = empathy_account_settings_new (cm->name, proto->name, service, str);
 
587
 
 
588
  g_free (str);
 
589
 
 
590
  if (!tp_strdiff (service, "google-talk"))
 
591
    {
 
592
      gchar *fallback_servers[] = {
 
593
          "talkx.l.google.com",
 
594
          "talkx.l.google.com:443,oldssl",
 
595
          "talkx.l.google.com:80",
 
596
          NULL};
 
597
 
 
598
      gchar *extra_certificate_identities[] = {
 
599
          "talk.google.com",
 
600
          NULL};
 
601
 
 
602
      empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
 
603
          NULL, NULL);
 
604
 
 
605
      empathy_account_settings_set_strv (settings, "fallback-servers",
 
606
          fallback_servers);
 
607
 
 
608
      if (empathy_account_settings_have_tp_param (settings,
 
609
              "extra-certificate-identities"))
 
610
        {
 
611
          empathy_account_settings_set_strv (settings,
 
612
              "extra-certificate-identities", extra_certificate_identities);
 
613
        }
 
614
    }
 
615
  else if (!tp_strdiff (service, "facebook"))
 
616
    {
 
617
      empathy_account_settings_set_icon_name_async (settings, "im-facebook",
 
618
          NULL, NULL);
 
619
 
 
620
      empathy_account_settings_set_string (settings, "server",
 
621
          "chat.facebook.com");
 
622
    }
 
623
 
 
624
out:
 
625
  tp_clear_object (&cm);
 
626
  g_free (service);
 
627
  return settings;
 
628
}