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

« back to all changes in this revision

Viewing changes to libempathy-gtk/empathy-theme-manager.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:
54
54
        gchar       *adium_path;
55
55
        GtkSettings *settings;
56
56
        GList       *boxes_views;
 
57
        guint        emit_changed_idle;
57
58
} EmpathyThemeManagerPriv;
58
59
 
59
60
enum {
392
393
        return FALSE;
393
394
}
394
395
 
 
396
typedef enum {
 
397
        THEME_TYPE_UNSET,
 
398
        THEME_TYPE_IRC,
 
399
        THEME_TYPE_BOXED,
 
400
        THEME_TYPE_ADIUM,
 
401
} ThemeType;
 
402
 
 
403
static ThemeType
 
404
theme_type (const gchar *name)
 
405
{
 
406
        if (name == NULL) {
 
407
                return THEME_TYPE_UNSET;
 
408
        } else if (!tp_strdiff (name, "classic")) {
 
409
                return THEME_TYPE_IRC;
 
410
        } else if (!tp_strdiff (name, "adium")) {
 
411
                return THEME_TYPE_ADIUM;
 
412
        } else {
 
413
                return THEME_TYPE_BOXED;
 
414
        }
 
415
}
 
416
 
 
417
static gboolean
 
418
theme_manager_emit_changed_idle_cb (gpointer manager)
 
419
{
 
420
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
 
421
 
 
422
        g_signal_emit (manager, signals[THEME_CHANGED], 0, NULL);
 
423
        priv->emit_changed_idle = 0;
 
424
 
 
425
        return FALSE;
 
426
}
 
427
 
 
428
static void
 
429
theme_manager_emit_changed (EmpathyThemeManager *manager)
 
430
{
 
431
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
 
432
 
 
433
        /* We emit the signal in idle callback to be sure we emit it only once
 
434
         * in the case both the name and adium_path changed */
 
435
        if (priv->emit_changed_idle == 0) {
 
436
                priv->emit_changed_idle = g_idle_add (
 
437
                        theme_manager_emit_changed_idle_cb, manager);
 
438
        }
 
439
}
 
440
 
395
441
static void
396
442
theme_manager_notify_name_cb (GSettings   *gsettings_chat,
397
443
                              const gchar *key,
400
446
        EmpathyThemeManager     *manager = EMPATHY_THEME_MANAGER (user_data);
401
447
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
402
448
        gchar                   *name;
 
449
        ThemeType                old_type;
 
450
        ThemeType                new_type;
403
451
 
404
452
        name = g_settings_get_string (gsettings_chat, key);
405
453
 
406
 
        if (!theme_manager_ensure_theme_exists (name) ||
407
 
            !tp_strdiff (priv->name, name)) {
408
 
                if (!priv->name) {
409
 
                        priv->name = g_strdup ("classic");
410
 
                }
 
454
        /* Fallback to classic theme if current setting does not exist */
 
455
        if (!theme_manager_ensure_theme_exists (name)) {
 
456
                g_free (name);
 
457
                name = g_strdup ("classic");
 
458
        }
411
459
 
 
460
        /* If theme did not change, nothing to do */
 
461
        if (!tp_strdiff (priv->name, name)) {
412
462
                g_free (name);
413
463
                return;
414
464
        }
415
465
 
 
466
        old_type = theme_type (priv->name);
416
467
        g_free (priv->name);
417
468
        priv->name = name;
 
469
        new_type = theme_type (priv->name);
418
470
 
419
 
        if (!tp_strdiff (priv->name, "simple") ||
420
 
            !tp_strdiff (priv->name, "clean") ||
421
 
            !tp_strdiff (priv->name, "blue")) {
 
471
        if (new_type == THEME_TYPE_BOXED) {
422
472
                GList *l;
423
473
 
424
474
                /* The theme changes to a boxed one, we can update boxed views */
428
478
                }
429
479
        }
430
480
 
431
 
        g_signal_emit (manager, signals[THEME_CHANGED], 0, NULL);
 
481
        /* Do not emit theme-changed if theme type didn't change, or if it was
 
482
         * unset (the manager is under construction). If theme changed from a
 
483
         * boxed to another boxed, all view are updated in place. If theme
 
484
         * changed from an adium to another adium, the signal will be emited
 
485
         * from theme_manager_notify_adium_path_cb ()
 
486
         */
 
487
        if (old_type != new_type && old_type != THEME_TYPE_UNSET) {
 
488
                theme_manager_emit_changed (manager);
 
489
        }
432
490
}
433
491
 
434
492
static void
439
497
        EmpathyThemeManager     *manager = EMPATHY_THEME_MANAGER (user_data);
440
498
        EmpathyThemeManagerPriv *priv = GET_PRIV (manager);
441
499
        gchar                   *adium_path = NULL;
 
500
        gboolean                 was_set;
442
501
 
443
502
        adium_path = g_settings_get_string (gsettings_chat, key);
444
503
 
447
506
                return;
448
507
        }
449
508
 
 
509
        was_set = (priv->adium_path != NULL);
 
510
 
450
511
        g_free (priv->adium_path);
451
512
        priv->adium_path = adium_path;
452
513
 
453
 
        g_signal_emit (manager, signals[THEME_CHANGED], 0, NULL);
 
514
        /* Do not emit the signal if path was not set yet (the manager is under
 
515
         * construction) */
 
516
        if (was_set) {
 
517
                theme_manager_emit_changed (manager);
 
518
        }
454
519
}
455
520
 
456
521
static void
470
535
        }
471
536
        g_list_free (priv->boxes_views);
472
537
 
 
538
        if (priv->emit_changed_idle != 0) {
 
539
                g_source_remove (priv->emit_changed_idle);
 
540
        }
 
541
 
473
542
        G_OBJECT_CLASS (empathy_theme_manager_parent_class)->finalize (object);
474
543
}
475
544