diff options
-rw-r--r-- | shell/cc-shell-category-view.c | 222 | ||||
-rw-r--r-- | shell/cc-shell-category-view.h | 76 | ||||
-rw-r--r-- | shell/cc-shell-item-view.c | 173 | ||||
-rw-r--r-- | shell/cc-shell-item-view.h | 74 | ||||
-rw-r--r-- | shell/cc-window.c | 1 | ||||
-rw-r--r-- | shell/meson.build | 2 |
6 files changed, 0 insertions, 548 deletions
diff --git a/shell/cc-shell-category-view.c b/shell/cc-shell-category-view.c deleted file mode 100644 index 41674479f..000000000 --- a/shell/cc-shell-category-view.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2010 Intel, Inc. - * - * The Control Center is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The Control Center is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the Control Center; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Thomas Wood <thos@gnome.org> - */ - -#include "cc-shell-category-view.h" -#include "cc-shell-item-view.h" -#include "cc-shell.h" -#include "cc-shell-model.h" - -G_DEFINE_TYPE (CcShellCategoryView, cc_shell_category_view, GTK_TYPE_FRAME) - -#define SHELL_CATEGORY_VIEW_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewPrivate)) - -enum -{ - PROP_NAME = 1, - PROP_MODEL -}; - -struct _CcShellCategoryViewPrivate -{ - gchar *name; - GtkTreeModel *model; - GtkWidget *iconview; -}; - -static void -cc_shell_category_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv; - - switch (property_id) - { - case PROP_NAME: - g_value_set_string (value, priv->name); - break; - - case PROP_MODEL: - g_value_set_object (value, priv->model); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_shell_category_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv; - - switch (property_id) - { - case PROP_NAME: - priv->name = g_value_dup_string (value); - break; - - case PROP_MODEL: - priv->model = g_value_dup_object (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_shell_category_view_dispose (GObject *object) -{ - CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv; - - if (priv->model) - { - g_object_unref (priv->model); - priv->model = NULL; - } - - G_OBJECT_CLASS (cc_shell_category_view_parent_class)->dispose (object); -} - -static void -cc_shell_category_view_finalize (GObject *object) -{ - CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv; - - if (priv->name) - { - g_free (priv->name); - priv->name = NULL; - } - - G_OBJECT_CLASS (cc_shell_category_view_parent_class)->finalize (object); -} - -static void -cc_shell_category_view_constructed (GObject *object) -{ - CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv; - GtkWidget *iconview, *vbox; - GtkCellRenderer *renderer; - - iconview = cc_shell_item_view_new (); - gtk_icon_view_set_model (GTK_ICON_VIEW (iconview), priv->model); - - vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); - - renderer = gtk_cell_renderer_pixbuf_new (); - g_object_set (renderer, - "stock-size", GTK_ICON_SIZE_DIALOG, - "follow-state", TRUE, - NULL); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (iconview), - renderer, FALSE); - gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (iconview), renderer, - "gicon", COL_GICON); - - gtk_icon_view_set_text_column (GTK_ICON_VIEW (iconview), COL_NAME); - gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 100); - cc_shell_item_view_update_cells (CC_SHELL_ITEM_VIEW (iconview)); - gtk_icon_view_set_columns (GTK_ICON_VIEW (iconview), 6); - - /* create the header if required */ - if (priv->name) - { - GtkWidget *label; - PangoAttrList *attrs; - - label = gtk_label_new (priv->name); - attrs = pango_attr_list_new (); - pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD)); - gtk_label_set_attributes (GTK_LABEL (label), attrs); - pango_attr_list_unref (attrs); - gtk_frame_set_label_widget (GTK_FRAME (object), label); - gtk_widget_show (label); - } - - /* add the iconview to the vbox */ - gtk_box_pack_start (GTK_BOX (vbox), iconview, FALSE, TRUE, 0); - - /* add the main vbox to the view */ - gtk_container_add (GTK_CONTAINER (object), vbox); - gtk_widget_show_all (vbox); - - priv->iconview = iconview; -} - -static void -cc_shell_category_view_class_init (CcShellCategoryViewClass *klass) -{ - GParamSpec *pspec; - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (CcShellCategoryViewPrivate)); - - object_class->get_property = cc_shell_category_view_get_property; - object_class->set_property = cc_shell_category_view_set_property; - object_class->dispose = cc_shell_category_view_dispose; - object_class->finalize = cc_shell_category_view_finalize; - object_class->constructed = cc_shell_category_view_constructed; - - pspec = g_param_spec_string ("name", - "Name", - "Name of the category", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY - | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_NAME, pspec); - - pspec = g_param_spec_object ("model", - "Model", - "Model of the category", - GTK_TYPE_TREE_MODEL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY - | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_MODEL, pspec); - -} - -static void -cc_shell_category_view_init (CcShellCategoryView *self) -{ - self->priv = SHELL_CATEGORY_VIEW_PRIVATE (self); - - gtk_frame_set_shadow_type (GTK_FRAME (self), GTK_SHADOW_NONE); -} - -GtkWidget * -cc_shell_category_view_new (const gchar *name, - GtkTreeModel *model) -{ - return g_object_new (CC_TYPE_SHELL_CATEGORY_VIEW, - "name", name, - "model", model, NULL); -} - -CcShellItemView* -cc_shell_category_view_get_item_view (CcShellCategoryView *self) -{ - return (CcShellItemView*) self->priv->iconview; -} diff --git a/shell/cc-shell-category-view.h b/shell/cc-shell-category-view.h deleted file mode 100644 index d43450114..000000000 --- a/shell/cc-shell-category-view.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2010 Intel, Inc. - * - * The Control Center is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The Control Center is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the Control Center; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Thomas Wood <thos@gnome.org> - */ - - -#ifndef _CC_SHELL_CATEGORY_VIEW_H -#define _CC_SHELL_CATEGORY_VIEW_H - -#include <gtk/gtk.h> -#include "cc-shell-item-view.h" - -G_BEGIN_DECLS - -#define CC_TYPE_SHELL_CATEGORY_VIEW cc_shell_category_view_get_type() - -#define CC_SHELL_CATEGORY_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryView)) - -#define CC_SHELL_CATEGORY_VIEW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass)) - -#define CC_IS_SHELL_CATEGORY_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CC_TYPE_SHELL_CATEGORY_VIEW)) - -#define CC_IS_SHELL_CATEGORY_VIEW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CC_TYPE_SHELL_CATEGORY_VIEW)) - -#define CC_SHELL_CATEGORY_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CC_TYPE_SHELL_CATEGORY_VIEW, CcShellCategoryViewClass)) - -typedef struct _CcShellCategoryView CcShellCategoryView; -typedef struct _CcShellCategoryViewClass CcShellCategoryViewClass; -typedef struct _CcShellCategoryViewPrivate CcShellCategoryViewPrivate; - -struct _CcShellCategoryView -{ - GtkFrame parent; - - CcShellCategoryViewPrivate *priv; -}; - -struct _CcShellCategoryViewClass -{ - GtkFrameClass parent_class; -}; - -GType cc_shell_category_view_get_type (void) G_GNUC_CONST; - -GtkWidget *cc_shell_category_view_new (const gchar *name, - GtkTreeModel *model); -CcShellItemView* cc_shell_category_view_get_item_view (CcShellCategoryView *self); - -G_END_DECLS - -#endif /* _CC_SHELL_CATEGORY_VIEW_H */ diff --git a/shell/cc-shell-item-view.c b/shell/cc-shell-item-view.c deleted file mode 100644 index bd1aeb735..000000000 --- a/shell/cc-shell-item-view.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2010 Intel, Inc. - * - * The Control Center is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The Control Center is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the Control Center; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Thomas Wood <thos@gnome.org> - */ - -#include "cc-shell-item-view.h" -#include "cc-shell-model.h" - -G_DEFINE_TYPE (CcShellItemView, cc_shell_item_view, GTK_TYPE_ICON_VIEW) - -#define SHELL_ITEM_VIEW_PRIVATE(o) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewPrivate)) - -struct _CcShellItemViewPrivate -{ - gpointer padding; -}; - - -enum -{ - DESKTOP_ITEM_ACTIVATED, - - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = {0,}; - -static void -cc_shell_item_view_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_shell_item_view_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - switch (property_id) - { - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -cc_shell_item_view_dispose (GObject *object) -{ - G_OBJECT_CLASS (cc_shell_item_view_parent_class)->dispose (object); -} - -static void -cc_shell_item_view_finalize (GObject *object) -{ - G_OBJECT_CLASS (cc_shell_item_view_parent_class)->finalize (object); -} - -static void -iconview_item_activated_cb (GtkIconView *icon_view, - GtkTreePath *path, - CcShellItemView *cc_view) -{ - GtkTreeModel *model; - GtkTreeIter iter; - gchar *name, *id; - - model = gtk_icon_view_get_model (icon_view); - - gtk_icon_view_unselect_all (icon_view); - - /* get the iter and ensure it is valid */ - if (!gtk_tree_model_get_iter (model, &iter, path)) - return; - - gtk_tree_model_get (model, &iter, - COL_NAME, &name, - COL_ID, &id, - -1); - - g_signal_emit (cc_view, signals[DESKTOP_ITEM_ACTIVATED], 0, - name, id); - - g_free (name); - g_free (id); -} - -void -cc_shell_item_view_update_cells (CcShellItemView *view) -{ - GList *cells, *l; - - cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (view)); - for (l = cells ; l != NULL; l = l->next) - { - GtkCellRenderer *cell = l->data; - - if (GTK_IS_CELL_RENDERER_TEXT (cell)) { - g_object_set (G_OBJECT (cell), - "wrap-mode", PANGO_WRAP_WORD, - NULL); - /* We only have one text cell */ - break; - } - } - g_list_free (cells); -} - -static void -cc_shell_item_view_class_init (CcShellItemViewClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - g_type_class_add_private (klass, sizeof (CcShellItemViewPrivate)); - - object_class->get_property = cc_shell_item_view_get_property; - object_class->set_property = cc_shell_item_view_set_property; - object_class->dispose = cc_shell_item_view_dispose; - object_class->finalize = cc_shell_item_view_finalize; - - signals[DESKTOP_ITEM_ACTIVATED] = g_signal_new ("desktop-item-activated", - CC_TYPE_SHELL_ITEM_VIEW, - G_SIGNAL_RUN_FIRST, - 0, - NULL, - NULL, - g_cclosure_marshal_generic, - G_TYPE_NONE, - 2, - G_TYPE_STRING, - G_TYPE_STRING); -} - -static void -cc_shell_item_view_init (CcShellItemView *self) -{ - self->priv = SHELL_ITEM_VIEW_PRIVATE (self); - - g_object_set (self, "margin", 0, NULL); - g_signal_connect (self, "item-activated", - G_CALLBACK (iconview_item_activated_cb), self); -} - -GtkWidget * -cc_shell_item_view_new (void) -{ - return g_object_new (CC_TYPE_SHELL_ITEM_VIEW, - "activate-on-single-click", TRUE, - NULL); -} diff --git a/shell/cc-shell-item-view.h b/shell/cc-shell-item-view.h deleted file mode 100644 index 777e819a1..000000000 --- a/shell/cc-shell-item-view.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2010 Intel, Inc. - * - * The Control Center is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - * - * The Control Center is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with the Control Center; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Author: Thomas Wood <thos@gnome.org> - */ - -#ifndef _CC_SHELL_ITEM_VIEW_H -#define _CC_SHELL_ITEM_VIEW_H - -#include <gtk/gtk.h> - -G_BEGIN_DECLS - -#define CC_TYPE_SHELL_ITEM_VIEW cc_shell_item_view_get_type() - -#define CC_SHELL_ITEM_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CC_TYPE_SHELL_ITEM_VIEW, CcShellItemView)) - -#define CC_SHELL_ITEM_VIEW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass)) - -#define CC_IS_SHELL_ITEM_VIEW(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CC_TYPE_SHELL_ITEM_VIEW)) - -#define CC_IS_SHELL_ITEM_VIEW_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CC_TYPE_SHELL_ITEM_VIEW)) - -#define CC_SHELL_ITEM_VIEW_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CC_TYPE_SHELL_ITEM_VIEW, CcShellItemViewClass)) - -typedef struct _CcShellItemView CcShellItemView; -typedef struct _CcShellItemViewClass CcShellItemViewClass; -typedef struct _CcShellItemViewPrivate CcShellItemViewPrivate; - -struct _CcShellItemView -{ - GtkIconView parent; - - CcShellItemViewPrivate *priv; -}; - -struct _CcShellItemViewClass -{ - GtkIconViewClass parent_class; -}; - -GType cc_shell_item_view_get_type (void) G_GNUC_CONST; - -GtkWidget *cc_shell_item_view_new (void); - -void cc_shell_item_view_update_cells (CcShellItemView *view); - -G_END_DECLS - -#endif /* _CC_SHELL_ITEM_VIEW_H */ diff --git a/shell/cc-window.c b/shell/cc-window.c index 382db54e1..9fba02581 100644 --- a/shell/cc-window.c +++ b/shell/cc-window.c @@ -39,7 +39,6 @@ #include "cc-application.h" #include "cc-panel.h" #include "cc-shell.h" -#include "cc-shell-category-view.h" #include "cc-shell-model.h" #include "cc-panel-list.h" #include "cc-panel-loader.h" diff --git a/shell/meson.build b/shell/meson.build index 73b18f84e..12622cfc1 100644 --- a/shell/meson.build +++ b/shell/meson.build @@ -48,8 +48,6 @@ sources = files( 'cc-object-storage.c', 'cc-panel-loader.c', 'cc-panel.c', - 'cc-shell-category-view.c', - 'cc-shell-item-view.c', 'cc-shell.c', 'main.c' ) |