~ubuntu-branches/ubuntu/precise/rhythmbox/precise-security

« back to all changes in this revision

Viewing changes to plugins/dbus-media-server/rb-dbus-media-server-plugin.c

  • Committer: Package Import Robot
  • Author(s): Rodney Dawes
  • Date: 2012-03-09 07:24:47 UTC
  • mfrom: (1.1.64)
  • Revision ID: package-import@ubuntu.com-20120309072447-ltf9ea8d9vj5zmiy
Tags: 2.95.5-0ubuntu1
* New upstream release. (LP: #949424)
  - Add support for allowing plug-ins to specify that they should be
    enabled by default. (LP: #934235)
  - Magnatune plug-in is re-enabled upstream.
  - Removal of gtk_dialog_run in most all cases.
  - Porting of more plug-ins to python-gi. 
* debian/control, debian/*.install:
  - Remove the useless coherence plug-in install file.
  - Move some core plug-ins into main rhythmbox package.
    + audiocd, generic-player, iradio, mmkeys, power-manager, rb
  - Split out the NPAPI plug-in to a separate package.
  - Split out the zeitgeist plug-in to a separate package.
  - Split out the magnatune store plug-in to a separate package.
  - Split out the visualizer plug-in to a separate package.
    + Disable building the visualizer plug-in package, as it needs
      libmx which is in universe and not main.
* debian/patches/*:
  - Refreshed patches against new source that had problems applying.
  - Remvoe the mpris name patch which is included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
498
498
{
499
499
        if (plugin->emit_updated_id == 0) {
500
500
                plugin->emit_updated_id =
501
 
                        g_idle_add ((GSourceFunc)emit_container_updated_cb, plugin);
 
501
                        g_idle_add_full (G_PRIORITY_LOW,
 
502
                                         (GSourceFunc)emit_container_updated_cb,
 
503
                                         plugin,
 
504
                                         NULL);
502
505
        }
503
506
}
504
507
 
981
984
{
982
985
        char *value;
983
986
        RBRefString *refstring;
 
987
        gboolean is_all;
984
988
        GList *l;
985
989
 
986
990
        gtk_tree_model_get (model, iter,
987
991
                            RHYTHMDB_PROPERTY_MODEL_COLUMN_TITLE, &value,
 
992
                            RHYTHMDB_PROPERTY_MODEL_COLUMN_PRIORITY, &is_all,
988
993
                            -1);
 
994
        if (is_all) {
 
995
                g_free (value);
 
996
                return;
 
997
        }
 
998
 
989
999
        refstring = rb_refstring_new (value);
990
1000
        g_free (value);
991
1001
 
992
1002
        for (l = prop_data->updated_values; l != NULL; l = l->next) {
993
1003
                if (refstring == (RBRefString *)l->data) {
 
1004
                        rb_refstring_unref (refstring);
994
1005
                        return;
995
1006
                }
996
1007
        }
997
1008
 
998
1009
        prop_data->updated_values = g_list_prepend (prop_data->updated_values, refstring);
999
 
        prop_data->updated = TRUE;
1000
1010
        emit_updated_in_idle (prop_data->source_data->plugin);
1001
1011
}
1002
1012
 
1277
1287
        const char *invalidated[] = { NULL };
1278
1288
        GVariantBuilder *properties;
1279
1289
        GVariant *parameters;
 
1290
        char *path;
1280
1291
 
1281
1292
        rb_debug ("updating properties for source %s", source_data->dbus_path);
1282
1293
        properties = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
1289
1300
                                    properties,
1290
1301
                                    invalidated);
1291
1302
        g_variant_builder_unref (properties);
 
1303
        if (source_data->flat) {
 
1304
                path = g_strdup (source_data->dbus_path);
 
1305
        } else {
 
1306
                path = g_strdup_printf ("%s/all", source_data->dbus_path);
 
1307
        }
1292
1308
        g_dbus_connection_emit_signal (plugin->connection,
1293
1309
                                       NULL,
1294
 
                                       source_data->dbus_path,
 
1310
                                       path,
1295
1311
                                       "org.freedesktop.DBus.Properties",
1296
1312
                                       "PropertiesChanged",
1297
1313
                                       parameters,
1298
1314
                                       &error);
 
1315
        g_free (path);
1299
1316
        if (error != NULL) {
1300
1317
                g_warning ("Unable to send property changes for MediaServer2 container %s: %s",
1301
1318
                           source_data->dbus_path,
1414
1431
                                g_variant_builder_add (eb, "{sv}", "ChildCount", g_variant_new_uint32 (value_count));
1415
1432
                        }
1416
1433
                        if (all_props || rb_str_in_strv ("ItemCount", filter)) {
1417
 
                                g_variant_builder_add (eb, "{sv}", "ItemCount", g_variant_new_uint32 (value_count));
 
1434
                                g_variant_builder_add (eb, "{sv}", "ItemCount", g_variant_new_uint32 (0));
1418
1435
                        }
1419
1436
                        if (all_props || rb_str_in_strv ("ContainerCount", filter)) {
1420
 
                                g_variant_builder_add (eb, "{sv}", "ContainerCount", g_variant_new_uint32 (0));
 
1437
                                g_variant_builder_add (eb, "{sv}", "ContainerCount", g_variant_new_uint32 (value_count));
1421
1438
                        }
1422
1439
                        if (all_props || rb_str_in_strv ("Searchable", filter)) {
1423
1440
                                g_variant_builder_add (eb, "{sv}", "Searchable", g_variant_new_boolean (FALSE));
1628
1645
}
1629
1646
 
1630
1647
static void
1631
 
source_updated (SourceRegistrationData *source_data, gboolean count_changed)
 
1648
source_parent_updated (SourceRegistrationData *source_data)
 
1649
{
 
1650
        GList *l;
 
1651
        for (l = source_data->plugin->categories; l != NULL; l = l->next) {
 
1652
                CategoryRegistrationData *category_data = l->data;
 
1653
                if (g_strcmp0 (source_data->parent_dbus_path, category_data->dbus_path) == 0) {
 
1654
                        category_data->updated = TRUE;
 
1655
                        break;
 
1656
                }
 
1657
        }
 
1658
        if (l == NULL) {
 
1659
                source_data->plugin->root_updated = TRUE;
 
1660
        }
 
1661
 
 
1662
        emit_updated_in_idle (source_data->plugin);
 
1663
}
 
1664
 
 
1665
static void
 
1666
source_updated (SourceRegistrationData *source_data)
1632
1667
{
1633
1668
        source_data->updated = TRUE;
1634
 
 
1635
 
        if (count_changed) {
1636
 
                GList *l;
1637
 
                for (l = source_data->plugin->categories; l != NULL; l = l->next) {
1638
 
                        CategoryRegistrationData *category_data = l->data;
1639
 
                        if (g_strcmp0 (source_data->parent_dbus_path, category_data->dbus_path) == 0) {
1640
 
                                category_data->updated = TRUE;
1641
 
                                break;
1642
 
                        }
1643
 
                }
1644
 
                if (l == NULL) {
1645
 
                        source_data->plugin->root_updated = TRUE;
1646
 
                }
1647
 
        }
1648
 
 
1649
1669
        emit_updated_in_idle (source_data->plugin);
1650
1670
}
1651
1671
 
1654
1674
static void
1655
1675
row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, SourceRegistrationData *source_data)
1656
1676
{
1657
 
        source_updated (source_data, TRUE);
 
1677
        source_updated (source_data);
1658
1678
}
1659
1679
 
1660
1680
static void
1661
1681
row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, SourceRegistrationData *source_data)
1662
1682
{
1663
 
        source_updated (source_data, TRUE);
 
1683
        source_updated (source_data);
1664
1684
}
1665
1685
 
1666
1686
static void
1677
1697
                return;
1678
1698
        }
1679
1699
 
1680
 
        source_updated (source_data, FALSE);
 
1700
        source_updated (source_data);
1681
1701
        for (l = source_data->properties; l != NULL; l = l->next) {
1682
1702
                SourcePropertyRegistrationData *prop_data = l->data;
1683
1703
                RBRefString *value;
1729
1749
                g_object_set (prop_data->model, "query-model", source_data->base_query_model, NULL);
1730
1750
        }
1731
1751
 
1732
 
        source_updated (source_data, TRUE);
 
1752
        source_updated (source_data);
1733
1753
}
1734
1754
 
1735
1755
static void
1736
1756
name_updated_cb (RBSource *source, GParamSpec *pspec, SourceRegistrationData *source_data)
1737
1757
{
1738
 
        source_updated (source_data, FALSE);
 
1758
        source_updated (source_data);
1739
1759
}
1740
1760
 
1741
1761
static void
1811
1831
                plugin->sources = g_list_remove (plugin->sources, source_data);
1812
1832
 
1813
1833
                /* emit 'updated' signal on parent container */
1814
 
                source_updated (source_data, FALSE);
 
1834
                source_parent_updated (source_data);
1815
1835
                destroy_registration_data (source_data);
1816
1836
        }
1817
1837
}