~ubuntu-branches/ubuntu/trusty/rhythmbox/trusty-proposed

« back to all changes in this revision

Viewing changes to sources/rb-source.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2011-11-22 03:30:41 UTC
  • mto: (1.3.2)
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: package-import@ubuntu.com-20111122033041-szxjds5epwzk345s
Tags: upstream-2.90.1~git20111117.f101562
ImportĀ upstreamĀ versionĀ 2.90.1~git20111117.f101562

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
static RBEntryView *default_get_entry_view (RBSource *source);
70
70
static void default_add_to_queue (RBSource *source, RBSource *queue);
71
71
static void default_move_to_trash (RBSource *source);
72
 
static GList * default_get_search_actions (RBSource *source);
73
72
static char *default_get_delete_action (RBSource *source);
74
73
 
75
74
static void rb_source_post_entry_deleted_cb (GtkTreeModel *model,
109
108
        guint update_visibility_id;
110
109
        guint update_status_id;
111
110
        RhythmDBEntryType *entry_type;
112
 
        RBSourceSearchType search_type;
113
111
 
114
112
        GSettings *settings;
 
113
 
 
114
        char *toolbar_path;
115
115
};
116
116
 
117
117
enum
122
122
        PROP_ENTRY_TYPE,
123
123
        PROP_BASE_QUERY_MODEL,
124
124
        PROP_PLAY_ORDER,
125
 
        PROP_SEARCH_TYPE,
126
125
        PROP_SETTINGS,
127
 
        PROP_SHOW_BROWSER
 
126
        PROP_SHOW_BROWSER,
 
127
        PROP_TOOLBAR_PATH
128
128
};
129
129
 
130
130
enum
149
149
        page_class->activate = default_activate;
150
150
        page_class->get_status = default_get_status;
151
151
 
152
 
        klass->impl_can_browse = (RBSourceFeatureFunc) rb_false_function;
153
152
        klass->impl_get_property_views = default_get_property_views;
154
153
        klass->impl_can_rename = default_can_rename;
155
154
        klass->impl_can_cut = (RBSourceFeatureFunc) rb_false_function;
165
164
        klass->impl_handle_eos = default_handle_eos;
166
165
        klass->impl_try_playlist = default_try_playlist;
167
166
        klass->impl_add_to_queue = default_add_to_queue;
168
 
        klass->impl_get_search_actions = default_get_search_actions;
169
167
        klass->impl_get_delete_action = default_get_delete_action;
170
168
        klass->impl_move_to_trash = default_move_to_trash;
171
169
 
237
235
                                                              G_PARAM_READABLE));
238
236
 
239
237
        /**
240
 
         * RBSource:search-type:
241
 
         *
242
 
         * The type of searching this source provides, as a RBSourceSearchType value.
243
 
         * This is used by the RBSourceHeader to modify the search box widget.
244
 
         */
245
 
        g_object_class_install_property (object_class,
246
 
                                         PROP_SEARCH_TYPE,
247
 
                                         g_param_spec_enum ("search-type",
248
 
                                                            "search-type",
249
 
                                                            "search type",
250
 
                                                            RB_TYPE_SOURCE_SEARCH_TYPE,
251
 
                                                            RB_SOURCE_SEARCH_NONE,
252
 
                                                            G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
253
 
        /**
254
238
         * RBSource:settings:
255
239
         *
256
240
         * The #GSettings instance storing settings for the source.  The instance must
277
261
                                                               TRUE,
278
262
                                                               G_PARAM_READWRITE));
279
263
        /**
 
264
         * RBSource:toolbar-path:
 
265
         *
 
266
         * UI manager path for a toolbar to display at the top of the source.
 
267
         * The #RBSource class doesn't actually display the toolbar anywhere.
 
268
         * Adding the toolbar to a container is the responsibility of a subclass
 
269
         * such as #RBBrowserSource.
 
270
         */
 
271
        g_object_class_install_property (object_class,
 
272
                                         PROP_TOOLBAR_PATH,
 
273
                                         g_param_spec_string ("toolbar-path",
 
274
                                                              "toolbar path",
 
275
                                                              "toolbar UI path",
 
276
                                                              NULL,
 
277
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
 
278
 
 
279
        /**
280
280
         * RBSource::filter-changed:
281
281
         * @source: the #RBSource
282
282
         *
346
346
                g_object_unref (source->priv->query_model);
347
347
        }
348
348
 
 
349
        g_free (source->priv->toolbar_path);
 
350
 
349
351
        G_OBJECT_CLASS (rb_source_parent_class)->finalize (object);
350
352
}
351
353
 
443
445
        case PROP_ENTRY_TYPE:
444
446
                source->priv->entry_type = g_value_get_object (value);
445
447
                break;
446
 
        case PROP_SEARCH_TYPE:
447
 
                source->priv->search_type = g_value_get_enum (value);
448
 
                break;
449
448
        case PROP_SETTINGS:
450
449
                source->priv->settings = g_value_dup_object (value);
451
450
                break;
452
451
        case PROP_SHOW_BROWSER:
453
452
                /* not connected to anything here */
454
453
                break;
 
454
        case PROP_TOOLBAR_PATH:
 
455
                source->priv->toolbar_path = g_value_dup_string (value);
 
456
                break;
455
457
        default:
456
458
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
457
459
                break;
482
484
        case PROP_PLAY_ORDER:
483
485
                g_value_set_object (value, NULL);               /* ? */
484
486
                break;
485
 
        case PROP_SEARCH_TYPE:
486
 
                g_value_set_enum (value, source->priv->search_type);
487
 
                break;
488
487
        case PROP_SETTINGS:
489
488
                g_value_set_object (value, source->priv->settings);
490
489
                break;
491
490
        case PROP_SHOW_BROWSER:
492
491
                g_value_set_boolean (value, FALSE);
493
492
                break;
 
493
        case PROP_TOOLBAR_PATH:
 
494
                g_value_set_string (value, source->priv->toolbar_path);
 
495
                break;
494
496
        default:
495
497
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
496
498
                break;
534
536
}
535
537
 
536
538
/**
537
 
 * rb_source_can_browse:
538
 
 * @source: a #RBSource
539
 
 *
540
 
 * Determines whether the source has a browser
541
 
 *
542
 
 * Return value: TRUE if this source has a browser
543
 
 */
544
 
gboolean
545
 
rb_source_can_browse (RBSource *source)
546
 
{
547
 
        RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
548
 
 
549
 
        return klass->impl_can_browse (source);
550
 
}
551
 
 
552
 
/**
553
539
 * rb_source_notify_filter_changed:
554
540
 * @source: a #RBSource
555
541
 *
1166
1152
        return NULL;
1167
1153
}
1168
1154
 
1169
 
static GList *
1170
 
default_get_search_actions (RBSource *source)
1171
 
{
1172
 
        return NULL;
1173
 
}
1174
 
 
1175
 
/**
1176
 
 * rb_source_get_search_actions:
1177
 
 * @source: a #RBSource
1178
 
 *
1179
 
 * Returns a list of UI action names. Buttons for these
1180
 
 * actions will be added to the search bar.  The source
1181
 
 * must identify the selected search action when constructing
1182
 
 * a database query for searching
1183
 
 *
1184
 
 * Return value: (element-type utf8) (transfer full): list of search actions
1185
 
 */
1186
 
GList *
1187
 
rb_source_get_search_actions (RBSource *source)
1188
 
{
1189
 
        RBSourceClass *klass = RB_SOURCE_GET_CLASS (source);
1190
 
 
1191
 
        return klass->impl_get_search_actions (source);
1192
 
}
1193
 
 
1194
1155
static char *
1195
1156
default_get_delete_action (RBSource *source)
1196
1157
{
1482
1443
 
1483
1444
        return etype;
1484
1445
}
1485
 
 
1486
 
GType
1487
 
rb_source_search_type_get_type (void)
1488
 
{
1489
 
        static GType etype = 0;
1490
 
 
1491
 
        if (etype == 0) {
1492
 
                static const GEnumValue values[] = {
1493
 
                        ENUM_ENTRY (RB_SOURCE_SEARCH_NONE, "none"),
1494
 
                        ENUM_ENTRY (RB_SOURCE_SEARCH_INCREMENTAL, "incremental"),
1495
 
                        ENUM_ENTRY (RB_SOURCE_SEARCH_EXPLICIT, "explicit"),
1496
 
                        { 0, 0, 0 }
1497
 
                };
1498
 
 
1499
 
                etype = g_enum_register_static ("RBSourceSearchType", values);
1500
 
        }
1501
 
 
1502
 
        return etype;
1503
 
}
1504
 
 
1505
1446
/* introspection annotations for vmethods */
1506
1447
 
1507
1448
/**
1538
1479
 * @entries: (element-type RB.RhythmDBEntry) (transfer none): list of entries to paste
1539
1480
 */
1540
1481
 
1541
 
/**
1542
 
 * impl_get_search_actions:
1543
 
 * @source: a #RBSource
1544
 
 *
1545
 
 * Return value: (element-type utf8) (transfer full): list of action names
1546
 
 */