~ubuntuone-control-tower/libubuntuone/stable-3-0

« back to all changes in this revision

Viewing changes to libubuntuone/u1-music-store.c

  • Committer: Rodrigo Moya
  • Date: 2009-11-26 12:12:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: rodrigo.moya@canonical.com-20091126121221-gxi028cd7px0eomq
Basic structure of the music store widget

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
19
 * Boston, MA 02110-1301, USA.
20
20
 */
 
21
 
 
22
#include "config.h"
 
23
#include <webkit/webkit.h>
 
24
#include "u1-music-store.h"
 
25
 
 
26
struct _U1MusicStorePrivate {
 
27
        GtkWidget *web_viewer;
 
28
};
 
29
 
 
30
G_DEFINE_TYPE(U1MusicStore, u1_music_store, GTK_TYPE_VBOX)
 
31
 
 
32
static void
 
33
u1_music_store_finalize (GObject *object)
 
34
{
 
35
        U1MusicStore *music_store = U1_MUSIC_STORE (object);
 
36
 
 
37
        if (music_store->priv != NULL) {
 
38
                g_free (music_store->priv);
 
39
                music_store->priv = NULL;
 
40
        }
 
41
 
 
42
        G_OBJECT_CLASS (u1_music_store_parent_class)->finalize (object);
 
43
}
 
44
 
 
45
static void
 
46
u1_music_store_class_init (U1MusicStoreClass *klass)
 
47
{
 
48
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
49
 
 
50
        object_class->finalize = u1_music_store_finalize;
 
51
}
 
52
 
 
53
static void
 
54
u1_music_store_init (U1MusicStore *music_store)
 
55
{
 
56
        GtkWidget *scroll;
 
57
 
 
58
        music_store->priv = g_new0 (U1MusicStorePrivate, 1);
 
59
 
 
60
        /* Create web viewer object */
 
61
        scroll = gtk_scrolled_window_new (NULL, NULL);
 
62
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
 
63
                                        GTK_POLICY_AUTOMATIC,
 
64
                                        GTK_POLICY_AUTOMATIC);
 
65
        gtk_widget_show (scroll);
 
66
 
 
67
        music_store->priv->web_viewer = webkit_web_view_new ();
 
68
        webkit_web_view_open (WEBKIT_WEB_VIEW (music_store->priv->web_viewer), U1_STORE_URL);
 
69
        gtk_widget_show (music_store->priv->web_viewer);
 
70
        gtk_container_add (GTK_SCROLLED_WINDOW (scroll), music_store->priv->web_viewer);
 
71
 
 
72
        gtk_box_pack_start (GTK_BOX (music_store), scroll, TRUE, TRUE, 3);
 
73
}
 
74
 
 
75
/**
 
76
 * u1_music_store_new:
 
77
 *
 
78
 * Create a new #U1MusicStore widget.
 
79
 *
 
80
 * Return value: the newly created widget.
 
81
 */
 
82
GtkWidget *
 
83
u1_music_store_new (void)
 
84
{
 
85
        U1MusicStore *music_store;
 
86
 
 
87
        music_store = g_object_new (U1_TYPE_MUSIC_STORE, NULL);
 
88
 
 
89
        return (GtkWidget *) music_store;
 
90
}