Fix a gtk-doc warning about different var names.
[mmediamanager.git] / libmmanager-gtk / mm-gtk-hit-view.c
blob2b60605c4764f765de59b3f6874ef4c537d98b4c
1 /* MManager - a Desktop wide manager for multimedia applications.
3 * Copyright (C) 2008 Cosimo Cecchi <cosimoc@gnome.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #include "mm-gtk-hit-view.h"
22 #include "mm-gtk-hit-store.h"
24 #include "libmmanager/mm-hit-collection.h"
26 #include <gtk/gtk.h>
27 #include <glib.h>
28 #include <glib/gi18n.h>
29 #include <glib-object.h>
31 G_DEFINE_TYPE (MMGtkHitView, mm_gtk_hit_view, GTK_TYPE_TREE_VIEW)
33 #define MM_GTK_HIT_VIEW_GET_PRIVATE(o) \
34 (G_TYPE_INSTANCE_GET_PRIVATE ((o), MM_GTK_TYPE_HIT_VIEW, MMGtkHitViewDetails))
36 struct _MMGtkHitViewDetails {
37 MMGtkHitStore *hit_store;
38 MMHitCollection *collection;
41 static void
42 mm_gtk_hit_view_class_init (MMGtkHitViewClass *klass)
44 GObjectClass *object_class = G_OBJECT_CLASS (klass);
46 g_type_class_add_private (klass, sizeof (MMGtkHitViewDetails));
49 static void
50 mm_gtk_hit_view_init (MMGtkHitView *self)
52 MMGtkHitViewDetails *details = self->details = MM_GTK_HIT_VIEW_GET_PRIVATE (self);
53 GtkTreeViewColumn *column;
54 GtkCellRenderer *pix_renderer;
55 GtkCellRenderer *text_renderer;
57 details->hit_store = mm_gtk_hit_store_new ();
58 gtk_tree_view_set_model (GTK_TREE_VIEW (self), GTK_TREE_MODEL (details->hit_store));
60 pix_renderer = gtk_cell_renderer_pixbuf_new ();
61 column = gtk_tree_view_column_new ();
62 gtk_tree_view_column_set_title (column, _("File"));
63 gtk_tree_view_column_pack_start (column, pix_renderer, FALSE);
64 gtk_tree_view_column_set_attributes (column, pix_renderer,
65 "gicon", MM_GTK_HIT_STORE_ICON_COL,
66 NULL);
67 text_renderer = gtk_cell_renderer_text_new ();
68 gtk_tree_view_column_pack_start (column, text_renderer, TRUE);
69 gtk_tree_view_column_set_attributes (column, text_renderer,
70 "text", MM_GTK_HIT_STORE_NAME_COL,
71 NULL);
72 gtk_tree_view_append_column (GTK_TREE_VIEW (self), column);
75 static void
76 set_collection (MMGtkHitView *self,
77 MMHitCollection *collection)
79 mm_gtk_hit_store_set_collection (self->details->hit_store,
80 collection);
83 /* public methods */
85 MMGtkHitView*
86 mm_gtk_hit_view_new (MMHitCollection *collection)
88 MMGtkHitView *self;
90 self = MM_GTK_HIT_VIEW (g_object_new (MM_GTK_TYPE_HIT_VIEW, NULL));
91 set_collection (self, collection);
93 return self;