static GObject * rb_library_browser_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_properties) { RBLibraryBrowserClass *klass; RBLibraryBrowser *browser; RBLibraryBrowserPrivate *priv; int i; klass = RB_LIBRARY_BROWSER_CLASS (g_type_class_peek (RB_TYPE_LIBRARY_BROWSER)); browser = RB_LIBRARY_BROWSER (G_OBJECT_CLASS (rb_library_browser_parent_class)-> constructor (type, n_construct_properties, construct_properties)); priv = RB_LIBRARY_BROWSER_GET_PRIVATE (browser); for (i = 0; i < num_browser_properties; i++) { RBPropertyView *view; view = rb_property_view_new (priv->db, browser_properties[i].type, _(browser_properties[i].name)); g_hash_table_insert (priv->property_views, (gpointer)(browser_properties[i].type), view); rb_property_view_set_selection_mode (view, GTK_SELECTION_MULTIPLE); g_signal_connect_object (G_OBJECT (view), "properties-selected", G_CALLBACK (view_property_selected_cb), browser, 0); g_signal_connect_object (G_OBJECT (view), "property-selection-reset", G_CALLBACK (view_selection_reset_cb), browser, 0); gtk_widget_show_all (GTK_WIDGET (view)); gtk_widget_set_no_show_all (GTK_WIDGET (view), TRUE); gtk_box_pack_start (GTK_BOX (browser), GTK_WIDGET (view), TRUE, TRUE, 0); } update_browser_views_visibility (browser); priv->browser_view_notify_id = eel_gconf_notification_add (CONF_UI_BROWSER_VIEWS, (GConfClientNotifyFunc) rb_library_browser_views_changed, browser); return G_OBJECT (browser); }
static void rb_library_browser_constructed (GObject *object) { RBLibraryBrowser *browser; RBLibraryBrowserPrivate *priv; int i; RB_CHAIN_GOBJECT_METHOD (rb_library_browser_parent_class, constructed, object); browser = RB_LIBRARY_BROWSER (object); priv = RB_LIBRARY_BROWSER_GET_PRIVATE (browser); for (i = 0; i < num_browser_properties; i++) { RBPropertyView *view; view = rb_property_view_new (priv->db, browser_properties[i].type, _(browser_properties[i].name)); g_hash_table_insert (priv->property_views, (gpointer)(browser_properties[i].type), view); rb_property_view_set_selection_mode (view, GTK_SELECTION_MULTIPLE); g_signal_connect_object (G_OBJECT (view), "properties-selected", G_CALLBACK (view_property_selected_cb), browser, 0); g_signal_connect_object (G_OBJECT (view), "property-selection-reset", G_CALLBACK (view_selection_reset_cb), browser, 0); gtk_widget_show_all (GTK_WIDGET (view)); gtk_widget_set_no_show_all (GTK_WIDGET (view), TRUE); gtk_box_pack_start (GTK_BOX (browser), GTK_WIDGET (view), TRUE, TRUE, 0); } update_browser_views_visibility (browser); priv->browser_view_notify_id = eel_gconf_notification_add (CONF_UI_BROWSER_VIEWS, (GConfClientNotifyFunc) rb_library_browser_views_changed, browser); }
static void rb_iradio_source_constructed (GObject *object) { RBIRadioSource *source; RBShell *shell; GtkAction *action; GSettings *settings; GtkUIManager *ui_manager; GtkWidget *grid; GtkWidget *paned; RBSourceToolbar *toolbar; gint size; GdkPixbuf *pixbuf; RB_CHAIN_GOBJECT_METHOD (rb_iradio_source_parent_class, constructed, object); source = RB_IRADIO_SOURCE (object); paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); g_object_get (source, "shell", &shell, NULL); g_object_get (shell, "db", &source->priv->db, "shell-player", &source->priv->player, "ui-manager", &ui_manager, NULL); g_object_unref (shell); gtk_icon_size_lookup (RB_SOURCE_ICON_SIZE, &size, NULL); pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), IRADIO_SOURCE_ICON, size, 0, NULL); g_object_set (source, "pixbuf", pixbuf, NULL); if (pixbuf != NULL) { g_object_unref (pixbuf); } settings = g_settings_new ("org.gnome.rhythmbox.plugins.iradio"); if (g_settings_get_boolean (settings, "initial-stations-loaded") == FALSE) { GObject *plugin; char *file; g_object_get (source, "plugin", &plugin, NULL); file = rb_find_plugin_data_file (plugin, "iradio-initial.xspf"); if (file != NULL) { char *uri = g_filename_to_uri (file, NULL, NULL); if (uri != NULL) { rb_iradio_source_add_from_playlist (source, uri); g_free (uri); g_settings_set_boolean (settings, "initial-stations-loaded", TRUE); } } g_free (file); g_object_unref (plugin); } source->priv->action_group = _rb_display_page_register_action_group (RB_DISPLAY_PAGE (source), "IRadioActions", rb_iradio_source_actions, G_N_ELEMENTS (rb_iradio_source_actions), source); action = gtk_action_group_get_action (source->priv->action_group, "MusicNewInternetRadioStation"); /* Translators: this is the toolbar button label for New Internet Radio Station action. */ g_object_set (action, "short-label", C_("Radio", "Add"), NULL); /* set up stations view */ source->priv->stations = rb_entry_view_new (source->priv->db, G_OBJECT (source->priv->player), FALSE, FALSE); rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_TITLE, TRUE); rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_GENRE, FALSE); /* rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_QUALITY, FALSE); */ rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_RATING, FALSE); /* rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_PLAY_COUNT, FALSE);*/ rb_entry_view_append_column (source->priv->stations, RB_ENTRY_VIEW_COL_LAST_PLAYED, FALSE); g_signal_connect_object (source->priv->stations, "notify::sort-order", G_CALLBACK (rb_iradio_source_songs_view_sort_order_changed_cb), source, 0); /* set up drag and drop for the song tree view. * we don't use RBEntryView's DnD support because it does too much. * we just want to be able to drop stations in to add them. */ g_signal_connect_object (source->priv->stations, "drag_data_received", G_CALLBACK (stations_view_drag_data_received_cb), source, 0); gtk_drag_dest_set (GTK_WIDGET (source->priv->stations), GTK_DEST_DEFAULT_ALL, stations_view_drag_types, 2, GDK_ACTION_COPY | GDK_ACTION_MOVE); g_signal_connect_object (source->priv->stations, "show_popup", G_CALLBACK (rb_iradio_source_songs_show_popup_cb), source, 0); /* set up genre entry view */ source->priv->genres = rb_property_view_new (source->priv->db, RHYTHMDB_PROP_GENRE, _("Genre")); gtk_widget_show_all (GTK_WIDGET (source->priv->genres)); gtk_widget_set_no_show_all (GTK_WIDGET (source->priv->genres), TRUE); g_signal_connect_object (source->priv->genres, "property-selected", G_CALLBACK (genre_selected_cb), source, 0); g_signal_connect_object (source->priv->genres, "property-selection-reset", G_CALLBACK (genre_selection_reset_cb), source, 0); g_object_set (source->priv->genres, "vscrollbar_policy", GTK_POLICY_AUTOMATIC, NULL); gtk_paned_pack1 (GTK_PANED (paned), GTK_WIDGET (source->priv->genres), FALSE, FALSE); gtk_paned_pack2 (GTK_PANED (paned), GTK_WIDGET (source->priv->stations), TRUE, FALSE); /* set up toolbar */ toolbar = rb_source_toolbar_new (RB_SOURCE (source), ui_manager); rb_source_toolbar_add_search_entry (toolbar, NULL, _("Search your internet radio stations")); grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 6); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_widget_set_margin_top (GTK_WIDGET (grid), 6); gtk_grid_attach (GTK_GRID (grid), GTK_WIDGET (toolbar), 0, 0, 1, 1); gtk_grid_attach (GTK_GRID (grid), paned, 0, 1, 1, 1); gtk_container_add (GTK_CONTAINER (source), grid); rb_source_bind_settings (RB_SOURCE (source), GTK_WIDGET (source->priv->stations), paned, GTK_WIDGET (source->priv->genres)); gtk_widget_show_all (GTK_WIDGET (source)); g_signal_connect_object (source->priv->player, "playing-source-changed", G_CALLBACK (playing_source_changed_cb), source, 0); source->priv->default_search = rb_iradio_source_search_new (); rb_iradio_source_do_query (source); }