aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-cell-renderer-combo.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-01-11 05:22:22 +0800
committerMilan Crha <mcrha@redhat.com>2012-01-11 05:22:22 +0800
commitdd49067b2acfb72419f97a0348dc2524c3bbf56e (patch)
tree5109e71f41723545a5a5f9245947324f15635165 /widgets/misc/e-cell-renderer-combo.c
parent73fe6fb330ac9fab009d2bcb5766a2b908a201c7 (diff)
downloadgsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar.gz
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar.bz2
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar.lz
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar.xz
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.tar.zst
gsoc2013-evolution-dd49067b2acfb72419f97a0348dc2524c3bbf56e.zip
Bug #667119 - Hard to change Attendee role in meeting editor
Diffstat (limited to 'widgets/misc/e-cell-renderer-combo.c')
-rw-r--r--widgets/misc/e-cell-renderer-combo.c202
1 files changed, 0 insertions, 202 deletions
diff --git a/widgets/misc/e-cell-renderer-combo.c b/widgets/misc/e-cell-renderer-combo.c
deleted file mode 100644
index 07382b9225..0000000000
--- a/widgets/misc/e-cell-renderer-combo.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Mike Kestner <mkestner@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-combo-cell-editable.h"
-#include "e-cell-renderer-combo.h"
-
-enum {
- PROP_0,
- PROP_LIST
-};
-
-struct _ECellRendererComboPriv {
- EComboCellEditable *editable;
- gchar *path;
- GList *list;
-};
-
-G_DEFINE_TYPE (
- ECellRendererCombo,
- e_cell_renderer_combo,
- GTK_TYPE_CELL_RENDERER_TEXT)
-
-static void
-ecrc_editing_done (GtkCellEditable *editable,
- ECellRendererCombo *cell)
-{
- const gchar *new_text;
-
- if (e_combo_cell_editable_cancelled (E_COMBO_CELL_EDITABLE (editable)))
- return;
-
- new_text = e_combo_cell_editable_get_text (E_COMBO_CELL_EDITABLE (editable));
-
- g_signal_emit_by_name (cell, "edited", cell->priv->path, new_text);
- g_free (cell->priv->path);
- cell->priv->path = NULL;
-}
-
-static GtkCellEditable *
-ecrc_start_editing (GtkCellRenderer *cell,
- GdkEvent *event,
- GtkWidget *widget,
- const gchar *path,
- const GdkRectangle *bg_area,
- const GdkRectangle *cell_area,
- GtkCellRendererState flags)
-{
- ECellRendererCombo *combo_cell = E_CELL_RENDERER_COMBO (cell);
- GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell);
- EComboCellEditable *editable;
- gboolean is_editable;
- gchar *text;
-
- g_object_get (text_cell, "editable", &is_editable, NULL);
-
- if (!is_editable)
- return NULL;
-
- g_object_get (text_cell, "text", &text, NULL);
-
- editable = E_COMBO_CELL_EDITABLE (e_combo_cell_editable_new ());
- e_combo_cell_editable_set_text (editable, text);
- e_combo_cell_editable_set_list (editable, combo_cell->priv->list);
- gtk_widget_show (GTK_WIDGET (editable));
-
- g_free (text);
-
- g_signal_connect (editable, "editing-done", G_CALLBACK (ecrc_editing_done), combo_cell);
-
- combo_cell->priv->editable = g_object_ref (editable);
- combo_cell->priv->path = g_strdup (path);
-
- return GTK_CELL_EDITABLE (editable);
-}
-
-static void
-ecrc_get_size (GtkCellRenderer *cell,
- GtkWidget *widget,
- const GdkRectangle *cell_area,
- gint *x_offset,
- gint *y_offset,
- gint *width,
- gint *height)
-{
- GtkWidget *btn;
- GtkRequisition req;
-
- if (GTK_CELL_RENDERER_CLASS (e_cell_renderer_combo_parent_class)->get_size)
- GTK_CELL_RENDERER_CLASS (e_cell_renderer_combo_parent_class)->get_size (cell, widget, cell_area, x_offset, y_offset, width, height);
-
- btn = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (btn), gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE));
- gtk_widget_get_preferred_size (btn, &req, NULL);
- *width += req.width;
- gtk_widget_destroy (btn);
-}
-
-static void
-ecrc_get_prop (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ECellRendererCombo *ecrc = E_CELL_RENDERER_COMBO (object);
-
- switch (property_id) {
- case PROP_LIST:
- g_value_set_pointer (value, ecrc->priv->list);
- break;
- default:
- break;
- }
-}
-
-static void
-ecrc_set_prop (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ECellRendererCombo *ecrc = E_CELL_RENDERER_COMBO (object);
-
- switch (property_id) {
- case PROP_LIST:
- ecrc->priv->list = g_value_get_pointer (value);
- break;
- default:
- break;
- }
-}
-
-static void
-ecrc_finalize (GObject *object)
-{
- ECellRendererCombo *cell = (ECellRendererCombo *) object;
-
- if (cell->priv->editable)
- g_object_unref (cell->priv->editable);
- cell->priv->editable = NULL;
-
- if (cell->priv->path)
- g_free (cell->priv->path);
- cell->priv->path = NULL;
-
- g_free (cell->priv);
-
- /* Chain up to parent's finalize() method. */
- G_OBJECT_CLASS (e_cell_renderer_combo_parent_class)->finalize (object);
-}
-
-static void
-e_cell_renderer_combo_init (ECellRendererCombo *cell)
-{
- cell->priv = g_new0 (ECellRendererComboPriv, 1);
-}
-
-static void
-e_cell_renderer_combo_class_init (ECellRendererComboClass *class)
-{
- GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class);
- GObjectClass *obj_class = G_OBJECT_CLASS (class);
-
- obj_class->get_property = ecrc_get_prop;
- obj_class->set_property = ecrc_set_prop;
- obj_class->finalize = ecrc_finalize;
-
- cell_class->start_editing = ecrc_start_editing;
- cell_class->get_size = ecrc_get_size;
-
- g_object_class_install_property (obj_class, PROP_LIST,
- g_param_spec_pointer ("list", "List", "List of items to popup.", G_PARAM_READWRITE));
-}
-
-GtkCellRenderer *
-e_cell_renderer_combo_new (void)
-{
- return GTK_CELL_RENDERER (g_object_new (E_TYPE_CELL_RENDERER_COMBO, NULL));
-}
-