[evolution-patches] Gal for Evolution 1.4 Patches
- From: JP Rosevear <jpr ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] Gal for Evolution 1.4 Patches
- Date: Mon, 16 Feb 2004 12:03:47 -0500
Two patches, one updates Radek's back port of Mike's name space patch to
include the gal-combo-* files and the other removes deprecated flags.
-JP
--
JP Rosevear <jpr ximian com>
Ximian, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.800.2.13
diff -u -r1.800.2.13 ChangeLog
--- ChangeLog 13 Feb 2004 21:51:52 -0000 1.800.2.13
+++ ChangeLog 16 Feb 2004 16:56:00 -0000
@@ -1,3 +1,7 @@
+2004-02-16 JP Rosevear <jpr ximian com>
+
+ * gal/a11y/Makefile.am: Remove DISABLE_DEPRECATED flags
+
2004-02-03 Chris Toshok <toshok ximian com>
* gal/e-text/e-text.c (e_text_command): it's possible to get to
Index: gal/a11y/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- gal/a11y/Makefile.am 11 Aug 2003 21:25:42 -0000 1.6
+++ gal/a11y/Makefile.am 16 Feb 2004 16:56:01 -0000
@@ -7,10 +7,6 @@
$(GNOME_BONOBO_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(ICONV_CFLAGS) \
- -DGTK_DISABLE_DEPRECATED=1 \
- -DGDK_DISABLE_DEPRECATED=1 \
- -DG_DISABLE_DEPRECATED=1 \
- -DGNOME_DISABLE_DEPRECATED=1 \
-DG_LOG_DOMAIN=\"gal-a11y\"
? autom4te.cache
? gal-dep.patch
? gal-namespace.patch
? temp.patch
? docs/gal-api.html
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/ChangeLog,v
retrieving revision 1.800.2.13
diff -u -r1.800.2.13 ChangeLog
--- ChangeLog 13 Feb 2004 21:51:52 -0000 1.800.2.13
+++ ChangeLog 16 Feb 2004 16:59:06 -0000
@@ -1,3 +1,9 @@
+2003-02-16 Mike Kestner <mkestner ximian com>
+
+ * gal/widgets/gtk-combo* : renamespace and move to
+ * gal/widgets/gal-combo* : here
+ * gal/widgets/Makefile.am : build new files
+
2004-02-03 Chris Toshok <toshok ximian com>
* gal/e-text/e-text.c (e_text_command): it's possible to get to
Index: gal/a11y/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/a11y/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- gal/a11y/Makefile.am 11 Aug 2003 21:25:42 -0000 1.6
+++ gal/a11y/Makefile.am 16 Feb 2004 16:59:07 -0000
@@ -7,10 +7,6 @@
$(GNOME_BONOBO_CFLAGS) \
$(GNOME_INCLUDEDIR) \
$(ICONV_CFLAGS) \
- -DGTK_DISABLE_DEPRECATED=1 \
- -DGDK_DISABLE_DEPRECATED=1 \
- -DG_DISABLE_DEPRECATED=1 \
- -DGNOME_DISABLE_DEPRECATED=1 \
-DG_LOG_DOMAIN=\"gal-a11y\"
Index: gal/e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.909.2.6
diff -u -r1.909.2.6 ChangeLog
--- gal/e-table/ChangeLog 13 Feb 2004 21:51:53 -0000 1.909.2.6
+++ gal/e-table/ChangeLog 16 Feb 2004 16:59:20 -0000
@@ -1,3 +1,7 @@
+2003-11-17 Mike Kestner <mkestner ximian com>
+
+ * e-table-config.c : use new gal_combo_* namespace.
+
2003-10-28 Suresh Chandrasekharan <suresh chandrasekharan sun com>
* Fix for "50258 libgal: shared object looks for wrong mo file"
Index: gal/e-table/e-table-config.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-config.c,v
retrieving revision 1.58.2.3
diff -u -r1.58.2.3 e-table-config.c
--- gal/e-table/e-table-config.c 3 Nov 2003 13:40:49 -0000 1.58.2.3
+++ gal/e-table/e-table-config.c 16 Feb 2004 16:59:21 -0000
@@ -270,7 +270,7 @@
}
/* Set the text */
- gtk_combo_text_set_text (widgets [i].combo, text);
+ gal_combo_text_set_text (widgets [i].combo, text);
g_signal_handler_unblock (
widgets [i].radio_ascending,
@@ -614,7 +614,7 @@
GtkWidget *
e_table_proxy_gtk_combo_text_new (void)
{
- return gtk_combo_text_new (TRUE);
+ return gal_combo_text_new (TRUE);
}
#if 0
@@ -707,10 +707,10 @@
char buffer [80];
snprintf (buffer, sizeof (buffer), "sort-combo-%d", i + 1);
- config->sort [i].combo = GTK_COMBO_TEXT (
+ config->sort [i].combo = GAL_COMBO_TEXT (
glade_xml_get_widget (gui, buffer));
gtk_widget_show (GTK_WIDGET (config->sort [i].combo));
- gtk_combo_text_add_item (config->sort [i].combo, "", "");
+ gal_combo_text_add_item (config->sort [i].combo, "", "");
snprintf (buffer, sizeof (buffer), "frame-sort-%d", i + 1);
config->sort [i].frames =
@@ -735,7 +735,7 @@
char *label = l->data;
for (i = 0; i < 4; i++){
- gtk_combo_text_add_item (config->sort [i].combo,
+ gal_combo_text_add_item (config->sort [i].combo,
dgettext (config->domain, label), label);
}
}
@@ -811,11 +811,11 @@
char buffer [80];
snprintf (buffer, sizeof (buffer), "group-combo-%d", i + 1);
- config->group [i].combo = GTK_COMBO_TEXT (
+ config->group [i].combo = GAL_COMBO_TEXT (
glade_xml_get_widget (gui, buffer));
gtk_widget_show (GTK_WIDGET (config->group [i].combo));
- gtk_combo_text_add_item (config->group [i].combo, "", "");
+ gal_combo_text_add_item (config->group [i].combo, "", "");
snprintf (buffer, sizeof (buffer), "frame-group-%d", i + 1);
config->group [i].frames =
@@ -847,7 +847,7 @@
char *label = l->data;
for (i = 0; i < 4; i++){
- gtk_combo_text_add_item (
+ gal_combo_text_add_item (
config->group [i].combo,
dgettext (config->domain, label), label);
}
Index: gal/e-table/e-table-config.h
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-config.h,v
retrieving revision 1.18
diff -u -r1.18 e-table-config.h
--- gal/e-table/e-table-config.h 19 Dec 2002 02:24:24 -0000 1.18
+++ gal/e-table/e-table-config.h 16 Feb 2004 16:59:21 -0000
@@ -27,7 +27,7 @@
#include <gal/e-table/e-table-sort-info.h>
#include <gal/e-table/e-table-specification.h>
-#include <gal/widgets/gtk-combo-text.h>
+#include <gal/widgets/gal-combo-text.h>
#include <gal/e-table/e-table-without.h>
#include <gal/e-table/e-table-subset-variable.h>
#include <gal/e-table/e-table.h>
@@ -43,7 +43,7 @@
#define E_TABLE_CONFIG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_CONFIG_TYPE, ETableConfigClass))
typedef struct {
- GtkComboText *combo;
+ GalComboText *combo;
GtkWidget *frames;
GtkWidget *radio_ascending;
GtkWidget *radio_descending;
Index: gal/widgets/Makefile.am
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/Makefile.am,v
retrieving revision 1.57
diff -u -r1.57 Makefile.am
--- gal/widgets/Makefile.am 28 Jul 2003 16:17:12 -0000 1.57
+++ gal/widgets/Makefile.am 16 Feb 2004 16:59:21 -0000
@@ -28,9 +28,9 @@
e-selection-model-simple.c \
e-selection-model.c \
e-unicode.c \
- gtk-combo-box.c \
- gtk-combo-stack.c \
- gtk-combo-text.c \
+ gal-combo-box.c \
+ gal-combo-stack.c \
+ gal-combo-text.c \
widget-color-combo.c \
widget-pixmap-combo.c
@@ -73,9 +73,9 @@
e-selection-model-simple.h \
e-selection-model.h \
e-unicode.h \
- gtk-combo-box.h \
- gtk-combo-stack.h \
- gtk-combo-text.h \
+ gal-combo-box.h \
+ gal-combo-stack.h \
+ gal-combo-text.h \
widget-color-combo.h \
widget-pixmap-combo.h
Index: gal/widgets/gal-combo-box.c
===================================================================
RCS file: gal/widgets/gal-combo-box.c
diff -N gal/widgets/gal-combo-box.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-box.c 16 Feb 2004 16:59:22 -0000
@@ -0,0 +1,834 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gtk-combo-box.c - a customizable combobox
+ * Copyright 2000, 2001, Ximian, Inc.
+ *
+ * Authors:
+ * Miguel de Icaza (miguel gnu org)
+ * Adrian E Feiguin (feiguin ifir edu ar)
+ * Paolo Molnaro (lupus debian org).
+ * Jon K Hellan (hellan acm org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkarrow.h>
+#include <gtk/gtkeventbox.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtkwindow.h>
+#include <gtk/gtkframe.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtktearoffmenuitem.h>
+#include <gdk/gdkkeysyms.h>
+#include "gal-combo-box.h"
+#include "gal/util/e-util.h"
+
+#define PARENT_TYPE GTK_TYPE_HBOX
+static GObjectClass *gal_combo_box_parent_class;
+
+static int gtk_combo_toggle_pressed (GtkToggleButton *tbutton,
+ GalComboBox *combo_box);
+static void gtk_combo_popup_tear_off (GalComboBox *combo,
+ gboolean set_position);
+static void gtk_combo_set_tearoff_state (GalComboBox *combo,
+ gboolean torn_off);
+static void gtk_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent,
+ gboolean unrealize);
+static gboolean cb_popup_delete (GtkWidget *w, GdkEventAny *event,
+ GalComboBox *combo);
+static void gtk_combo_tearoff_bg_copy (GalComboBox *combo);
+
+enum {
+ POP_DOWN_WIDGET,
+ POP_DOWN_DONE,
+ PRE_POP_DOWN,
+ POST_POP_HIDE,
+ LAST_SIGNAL
+};
+
+static guint gal_combo_box_signals [LAST_SIGNAL] = { 0, };
+
+struct _GalComboBoxPrivate {
+ GtkWidget *pop_down_widget;
+ GtkWidget *display_widget;
+
+ /*
+ * Internal widgets used to implement the ComboBox
+ */
+ GtkWidget *frame;
+ GtkWidget *arrow_button;
+
+ GtkWidget *toplevel; /* Popup's toplevel when not torn off */
+ GtkWidget *tearoff_window; /* Popup's toplevel when torn off */
+ guint torn_off;
+
+ GtkWidget *tearable; /* The tearoff "button" */
+ GtkWidget *popup; /* Popup */
+
+ /*
+ * Closure for invoking the callbacks above
+ */
+ void *closure;
+};
+
+static void
+gal_combo_box_finalize (GObject *object)
+{
+ GalComboBox *combo_box = GAL_COMBO_BOX (object);
+
+ g_free (combo_box->priv);
+
+ gal_combo_box_parent_class->finalize (object);
+}
+
+static void
+gal_combo_box_destroy (GtkObject *object)
+{
+ GtkObjectClass *klass = (GtkObjectClass *)gal_combo_box_parent_class;
+ GalComboBox *combo_box = GAL_COMBO_BOX (object);
+
+ if (combo_box->priv->toplevel) {
+ gtk_object_destroy (GTK_OBJECT (combo_box->priv->toplevel));
+ combo_box->priv->toplevel = NULL;
+ }
+
+ if (combo_box->priv->tearoff_window) {
+ gtk_object_destroy (GTK_OBJECT (combo_box->priv->tearoff_window));
+ combo_box->priv->tearoff_window = NULL;
+ }
+
+ if (klass->destroy)
+ klass->destroy (object);
+}
+
+static gboolean
+gal_combo_box_mnemonic_activate (GtkWidget *w, gboolean group_cycling)
+{
+ GalComboBox *combo_box = GAL_COMBO_BOX (w);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (combo_box->priv->arrow_button), TRUE);
+ return TRUE;
+}
+
+static void
+gal_combo_box_class_init (GObjectClass *object_class)
+{
+ GtkWidgetClass *widget_class = (GtkWidgetClass *)object_class;
+ gal_combo_box_parent_class = g_type_class_peek_parent (object_class);
+
+ object_class->finalize = gal_combo_box_finalize;
+ widget_class->mnemonic_activate = gal_combo_box_mnemonic_activate;
+ ((GtkObjectClass *)object_class)->destroy = gal_combo_box_destroy;
+
+ gal_combo_box_signals [POP_DOWN_WIDGET] = g_signal_new (
+ "pop_down_widget",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalComboBoxClass, pop_down_widget),
+ NULL, NULL,
+ e_marshal_POINTER__NONE,
+ G_TYPE_POINTER, 0, G_TYPE_NONE);
+
+ gal_combo_box_signals [POP_DOWN_DONE] = g_signal_new (
+ "pop_down_done",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalComboBoxClass, pop_down_done),
+ NULL, NULL,
+ e_marshal_BOOLEAN__OBJECT,
+ G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT);
+
+ gal_combo_box_signals [PRE_POP_DOWN] = g_signal_new (
+ "pre_pop_down",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalComboBoxClass, pre_pop_down),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
+ gal_combo_box_signals [POST_POP_HIDE] = g_signal_new (
+ "post_pop_hide",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GalComboBoxClass, post_pop_hide),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+}
+
+static void
+deactivate_arrow (GalComboBox *combo_box)
+{
+ GtkToggleButton *arrow;
+
+ arrow = GTK_TOGGLE_BUTTON (combo_box->priv->arrow_button);
+ g_signal_handlers_block_matched (arrow,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ gtk_combo_toggle_pressed, combo_box);
+
+ gtk_toggle_button_set_active (arrow, FALSE);
+
+ g_signal_handlers_unblock_matched (arrow,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ gtk_combo_toggle_pressed, combo_box);
+}
+
+/**
+ * gal_combo_box_popup_hide_unconditional
+ * @combo_box: Combo box
+ *
+ * Hide popup, whether or not it is torn off.
+ */
+static void
+gal_combo_box_popup_hide_unconditional (GalComboBox *combo_box)
+{
+ gboolean popup_info_destroyed = FALSE;
+
+ g_return_if_fail (combo_box != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo_box));
+
+ gtk_widget_hide (combo_box->priv->toplevel);
+ gtk_widget_hide (combo_box->priv->popup);
+ if (combo_box->priv->torn_off) {
+ GTK_TEAROFF_MENU_ITEM (combo_box->priv->tearable)->torn_off
+ = FALSE;
+ gtk_combo_set_tearoff_state (combo_box, FALSE);
+ }
+
+ gtk_grab_remove (combo_box->priv->toplevel);
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+
+ g_object_ref (combo_box->priv->pop_down_widget);
+ g_signal_emit (combo_box,
+ gal_combo_box_signals [POP_DOWN_DONE], 0,
+ combo_box->priv->pop_down_widget, &popup_info_destroyed);
+
+ if (popup_info_destroyed){
+ gtk_container_remove (
+ GTK_CONTAINER (combo_box->priv->frame),
+ combo_box->priv->pop_down_widget);
+ combo_box->priv->pop_down_widget = NULL;
+ }
+ g_object_unref (combo_box->priv->pop_down_widget);
+ deactivate_arrow (combo_box);
+
+ g_signal_emit (combo_box, gal_combo_box_signals [POST_POP_HIDE], 0);
+}
+
+/**
+ * gal_combo_box_popup_hide:
+ * @combo_box: Combo box
+ *
+ * Hide popup, but not when it is torn off.
+ * This is the external interface - for subclasses and apps which expect a
+ * regular combo which doesn't do tearoffs.
+ */
+void
+gal_combo_box_popup_hide (GalComboBox *combo_box)
+{
+ if (!combo_box->priv->torn_off)
+ gal_combo_box_popup_hide_unconditional (combo_box);
+ else if (GTK_WIDGET_VISIBLE (combo_box->priv->toplevel)) {
+ /* Both popup and tearoff window present. Get rid of just
+ the popup shell. */
+ gtk_combo_popup_tear_off (combo_box, FALSE);
+ deactivate_arrow (combo_box);
+ }
+}
+
+/*
+ * Find best location for displaying
+ */
+void
+gal_combo_box_get_pos (GalComboBox *combo_box, int *x, int *y)
+{
+ GtkWidget *wcombo = GTK_WIDGET (combo_box);
+ int ph, pw;
+
+ gdk_window_get_origin (wcombo->window, x, y);
+ *y += wcombo->allocation.height + wcombo->allocation.y;
+ *x += wcombo->allocation.x;
+
+ ph = combo_box->priv->popup->allocation.height;
+ pw = combo_box->priv->popup->allocation.width;
+
+ if ((*y + ph) > gdk_screen_height ())
+ *y = gdk_screen_height () - ph;
+
+ if ((*x + pw) > gdk_screen_width ())
+ *x = gdk_screen_width () - pw;
+}
+
+static void
+gal_combo_box_popup_display (GalComboBox *combo_box)
+{
+ int x, y;
+
+ g_return_if_fail (combo_box != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo_box));
+
+ /*
+ * If we have no widget to display on the popdown,
+ * create it
+ */
+ if (!combo_box->priv->pop_down_widget){
+ GtkWidget *pw = NULL;
+
+ g_signal_emit (combo_box,
+ gal_combo_box_signals [POP_DOWN_WIDGET], 0, &pw);
+ g_assert (pw != NULL);
+ combo_box->priv->pop_down_widget = pw;
+ gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), pw);
+ }
+
+ g_signal_emit (combo_box, gal_combo_box_signals [PRE_POP_DOWN], 0);
+
+ if (combo_box->priv->torn_off) {
+ /* To give the illusion that tearoff still displays the
+ * popup, we copy the image in the popup window to the
+ * background. Thus, it won't be blank after reparenting */
+ gtk_combo_tearoff_bg_copy (combo_box);
+
+ /* We force an unrealize here so that we don't trigger
+ * redrawing/ clearing code - we just want to reveal our
+ * backing pixmap.
+ */
+ gtk_combo_popup_reparent (combo_box->priv->popup,
+ combo_box->priv->toplevel, TRUE);
+ }
+
+ gal_combo_box_get_pos (combo_box, &x, &y);
+
+ gtk_widget_set_uposition (combo_box->priv->toplevel, x, y);
+ gtk_widget_realize (combo_box->priv->popup);
+ gtk_widget_show (combo_box->priv->popup);
+ gtk_widget_realize (combo_box->priv->toplevel);
+ gtk_widget_show (combo_box->priv->toplevel);
+
+ gtk_grab_add (combo_box->priv->toplevel);
+ gdk_pointer_grab (combo_box->priv->toplevel->window, TRUE,
+ GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_MASK,
+ NULL, NULL, GDK_CURRENT_TIME);
+}
+
+static int
+gtk_combo_toggle_pressed (GtkToggleButton *tbutton, GalComboBox *combo_box)
+{
+ if (tbutton->active)
+ gal_combo_box_popup_display (combo_box);
+ else
+ gal_combo_box_popup_hide_unconditional (combo_box);
+
+ return TRUE;
+}
+
+static gint
+gal_combo_box_button_press (GtkWidget *widget, GdkEventButton *event, GalComboBox *combo_box)
+{
+ GtkWidget *child;
+
+ child = gtk_get_event_widget ((GdkEvent *) event);
+ if (child != widget){
+ while (child){
+ if (child == widget)
+ return FALSE;
+ child = child->parent;
+ }
+ }
+
+ gal_combo_box_popup_hide (combo_box);
+ return TRUE;
+}
+
+/**
+ * gal_combo_box_key_press
+ * @widget: Widget
+ * @event: Event
+ * @combo_box: Combo box
+ *
+ * Key press handler which dismisses popup on escape.
+ * Popup is dismissed whether or not popup is torn off.
+ */
+static gint
+gal_combo_box_key_press (GtkWidget *widget, GdkEventKey *event,
+ GalComboBox *combo_box)
+{
+ if (event->keyval == GDK_Escape) {
+ gal_combo_box_popup_hide_unconditional (combo_box);
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+static void
+cb_state_change (GtkWidget *widget, GtkStateType old_state, GalComboBox *combo_box)
+{
+ GtkStateType const new_state = GTK_WIDGET_STATE(widget);
+ gtk_widget_set_state (combo_box->priv->display_widget, new_state);
+}
+
+static void
+gal_combo_box_init (GalComboBox *combo_box)
+{
+ GtkWidget *arrow;
+ GdkCursor *cursor;
+
+ combo_box->priv = g_new0 (GalComboBoxPrivate, 1);
+
+ /*
+ * Create the arrow
+ */
+ combo_box->priv->arrow_button = gtk_toggle_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (combo_box->priv->arrow_button), GTK_RELIEF_NONE);
+ GTK_WIDGET_UNSET_FLAGS (combo_box->priv->arrow_button, GTK_CAN_FOCUS);
+
+ arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (combo_box->priv->arrow_button), arrow);
+ gtk_box_pack_end (GTK_BOX (combo_box), combo_box->priv->arrow_button, FALSE, FALSE, 0);
+ g_signal_connect (combo_box->priv->arrow_button, "toggled",
+ G_CALLBACK (gtk_combo_toggle_pressed), combo_box);
+ gtk_widget_show_all (combo_box->priv->arrow_button);
+
+ /*
+ * prelight the display widget when mousing over the arrow.
+ */
+ g_signal_connect (combo_box->priv->arrow_button, "state-changed",
+ G_CALLBACK (cb_state_change), combo_box);
+
+ /*
+ * The pop-down container
+ */
+
+ combo_box->priv->toplevel = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_ref (combo_box->priv->toplevel);
+ gtk_object_sink (GTK_OBJECT (combo_box->priv->toplevel));
+ gtk_window_set_policy (GTK_WINDOW (combo_box->priv->toplevel),
+ FALSE, TRUE, FALSE);
+
+ combo_box->priv->popup = gtk_event_box_new ();
+ gtk_container_add (GTK_CONTAINER (combo_box->priv->toplevel),
+ combo_box->priv->popup);
+ gtk_widget_show (combo_box->priv->popup);
+
+ gtk_widget_realize (combo_box->priv->popup);
+ cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
+ gdk_window_set_cursor (combo_box->priv->popup->window, cursor);
+ gdk_cursor_destroy (cursor);
+
+ combo_box->priv->torn_off = FALSE;
+ combo_box->priv->tearoff_window = NULL;
+
+ combo_box->priv->frame = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (combo_box->priv->popup),
+ combo_box->priv->frame);
+ gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->frame), GTK_SHADOW_OUT);
+
+ g_signal_connect (combo_box->priv->toplevel, "button_press_event",
+ G_CALLBACK (gal_combo_box_button_press), combo_box);
+ g_signal_connect (combo_box->priv->toplevel, "key_press_event",
+ G_CALLBACK (gal_combo_box_key_press), combo_box);
+}
+
+E_MAKE_TYPE (gal_combo_box,
+ "MyGalComboBox",
+ GalComboBox,
+ gal_combo_box_class_init,
+ gal_combo_box_init,
+ PARENT_TYPE)
+
+/**
+ * gal_combo_box_set_display:
+ * @combo_box: the Combo Box to modify
+ * @display_widget: The widget to be displayed
+
+ * Sets the displayed widget for the @combo_box to be @display_widget
+ */
+void
+gal_combo_box_set_display (GalComboBox *combo_box, GtkWidget *display_widget)
+{
+ g_return_if_fail (combo_box != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo_box));
+ g_return_if_fail (display_widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (display_widget));
+
+ if (combo_box->priv->display_widget &&
+ combo_box->priv->display_widget != display_widget)
+ gtk_container_remove (GTK_CONTAINER (combo_box),
+ combo_box->priv->display_widget);
+
+ combo_box->priv->display_widget = display_widget;
+
+ gtk_box_pack_start (GTK_BOX (combo_box), display_widget, TRUE, TRUE, 0);
+}
+
+static gboolean
+cb_tearable_enter_leave (GtkWidget *w, GdkEventCrossing *event, gpointer data)
+{
+ gboolean const flag = GPOINTER_TO_INT(data);
+ gtk_widget_set_state (w, flag ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
+ return FALSE;
+}
+
+/**
+ * gtk_combo_popup_tear_off
+ * @combo: Combo box
+ * @set_position: Set to position of popup shell if true
+ *
+ * Tear off the popup
+ *
+ * FIXME:
+ * Gtk popup menus are toplevel windows, not dialogs. I think this is wrong,
+ * and make the popups dialogs. But may be there should be a way to make
+ * them toplevel. We can do this after creating:
+ * GTK_WINDOW (tearoff)->type = GTK_WINDOW_TOPLEVEL;
+ */
+static void
+gtk_combo_popup_tear_off (GalComboBox *combo, gboolean set_position)
+{
+ int x, y;
+
+ if (!combo->priv->tearoff_window) {
+ GtkWidget *tearoff;
+ gchar *title;
+
+ /* FIXME: made this a toplevel, not a dialog ! */
+ tearoff = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_widget_ref (tearoff);
+ gtk_object_sink (GTK_OBJECT (tearoff));
+ combo->priv->tearoff_window = tearoff;
+ gtk_widget_set_app_paintable (tearoff, TRUE);
+ g_signal_connect (tearoff, "key_press_event",
+ G_CALLBACK (gal_combo_box_key_press),
+ combo);
+ gtk_widget_realize (tearoff);
+ title = g_object_get_data (G_OBJECT (combo),
+ "gtk-combo-title");
+ if (title)
+ gdk_window_set_title (tearoff->window, title);
+ gtk_window_set_policy (GTK_WINDOW (tearoff),
+ FALSE, TRUE, FALSE);
+ gtk_window_set_transient_for
+ (GTK_WINDOW (tearoff),
+ GTK_WINDOW (gtk_widget_get_toplevel
+ GTK_WIDGET (combo)));
+ }
+
+ if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
+ gtk_widget_hide (combo->priv->toplevel);
+
+ gtk_grab_remove (combo->priv->toplevel);
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
+ }
+
+ gtk_combo_popup_reparent (combo->priv->popup,
+ combo->priv->tearoff_window, FALSE);
+
+ /* It may have got confused about size */
+ gtk_widget_queue_resize (GTK_WIDGET (combo->priv->popup));
+
+ if (set_position) {
+ gal_combo_box_get_pos (combo, &x, &y);
+ gtk_widget_set_uposition (combo->priv->tearoff_window, x, y);
+ }
+ gtk_widget_show (GTK_WIDGET (combo->priv->popup));
+ gtk_widget_show (combo->priv->tearoff_window);
+
+}
+
+/**
+ * gtk_combo_set_tearoff_state
+ * @combo_box: Combo box
+ * @torn_off: TRUE: Tear off. FALSE: Pop down and reattach
+ *
+ * Set the tearoff state of the popup
+ *
+ * Compare with gtk_menu_set_tearoff_state in gtk/gtkmenu.c
+ */
+static void
+gtk_combo_set_tearoff_state (GalComboBox *combo,
+ gboolean torn_off)
+{
+ g_return_if_fail (combo != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo));
+
+ if (combo->priv->torn_off != torn_off) {
+ combo->priv->torn_off = torn_off;
+
+ if (combo->priv->torn_off) {
+ gtk_combo_popup_tear_off (combo, TRUE);
+ deactivate_arrow (combo);
+ } else {
+ gtk_widget_hide (combo->priv->tearoff_window);
+ gtk_combo_popup_reparent (combo->priv->popup,
+ combo->priv->toplevel,
+ FALSE);
+ }
+ }
+}
+
+/**
+ * gtk_combo_tearoff_bg_copy
+ * @combo_box: Combo box
+ *
+ * Copy popup window image to the tearoff window.
+ */
+static void
+gtk_combo_tearoff_bg_copy (GalComboBox *combo)
+{
+ GdkPixmap *pixmap;
+ GdkGC *gc;
+ GdkGCValues gc_values;
+
+ GtkWidget *widget = combo->priv->popup;
+
+ if (combo->priv->torn_off) {
+ gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
+ gc = gdk_gc_new_with_values (widget->window,
+ &gc_values, GDK_GC_SUBWINDOW);
+
+ pixmap = gdk_pixmap_new (widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ -1);
+
+ gdk_draw_pixmap (pixmap, gc,
+ widget->window,
+ 0, 0, 0, 0, -1, -1);
+ gdk_gc_unref (gc);
+
+ gtk_widget_set_usize (combo->priv->tearoff_window,
+ widget->allocation.width,
+ widget->allocation.height);
+
+ gdk_window_set_back_pixmap
+ (combo->priv->tearoff_window->window, pixmap, FALSE);
+ gdk_pixmap_unref (pixmap);
+ }
+}
+
+/**
+ * gtk_combo_popup_reparent
+ * @popup: Popup
+ * @new_parent: New parent
+ * @unrealize: Unrealize popup if TRUE.
+ *
+ * Reparent the popup, taking care of the refcounting
+ *
+ * Compare with gtk_menu_reparent in gtk/gtkmenu.c
+ */
+static void
+gtk_combo_popup_reparent (GtkWidget *popup,
+ GtkWidget *new_parent,
+ gboolean unrealize)
+{
+ GtkObject *object = GTK_OBJECT (popup);
+ gboolean was_floating = GTK_OBJECT_FLOATING (object);
+
+ g_object_ref (object);
+ gtk_object_sink (object);
+
+ if (unrealize) {
+ g_object_ref (object);
+ gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
+ gtk_container_add (GTK_CONTAINER (new_parent), popup);
+ g_object_unref (object);
+ }
+ else
+ gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
+ gtk_widget_set_usize (new_parent, -1, -1);
+
+ if (was_floating)
+ GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING);
+ else
+ g_object_unref (object);
+}
+
+/**
+ * cb_tearable_button_release
+ * @w: Widget
+ * @event: Event
+ * @combo: Combo box
+ *
+ * Toggle tearoff state.
+ */
+static gboolean
+cb_tearable_button_release (GtkWidget *w, GdkEventButton *event,
+ GalComboBox *combo)
+{
+ GtkTearoffMenuItem *tearable;
+
+ g_return_val_if_fail (w != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_TEAROFF_MENU_ITEM (w), FALSE);
+
+ tearable = GTK_TEAROFF_MENU_ITEM (w);
+ tearable->torn_off = !tearable->torn_off;
+
+ if (!combo->priv->torn_off) {
+ gboolean need_connect;
+
+ need_connect = (!combo->priv->tearoff_window);
+ gtk_combo_set_tearoff_state (combo, TRUE);
+ if (need_connect)
+ g_signal_connect (combo->priv->tearoff_window,
+ "delete_event",
+ G_CALLBACK (cb_popup_delete),
+ combo);
+ } else
+ gal_combo_box_popup_hide_unconditional (combo);
+
+ return TRUE;
+}
+
+static gboolean
+cb_popup_delete (GtkWidget *w, GdkEventAny *event, GalComboBox *combo)
+{
+ gal_combo_box_popup_hide_unconditional (combo);
+ return TRUE;
+}
+
+void
+gal_combo_box_construct (GalComboBox *combo_box, GtkWidget *display_widget, GtkWidget *pop_down_widget)
+{
+ GtkWidget *tearable;
+ GtkWidget *vbox;
+
+ g_return_if_fail (combo_box != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo_box));
+ g_return_if_fail (display_widget != NULL);
+ g_return_if_fail (GTK_IS_WIDGET (display_widget));
+
+ GTK_BOX (combo_box)->spacing = 0;
+ GTK_BOX (combo_box)->homogeneous = FALSE;
+
+ combo_box->priv->pop_down_widget = pop_down_widget;
+ combo_box->priv->display_widget = NULL;
+
+ vbox = gtk_vbox_new (FALSE, 5);
+ tearable = gtk_tearoff_menu_item_new ();
+ g_signal_connect (tearable, "enter-notify-event",
+ G_CALLBACK (cb_tearable_enter_leave),
+ GINT_TO_POINTER (TRUE));
+ g_signal_connect (tearable, "leave-notify-event",
+ G_CALLBACK (cb_tearable_enter_leave),
+ GINT_TO_POINTER (FALSE));
+ g_signal_connect (tearable, "button-release-event",
+ G_CALLBACK (cb_tearable_button_release),
+ (gpointer) combo_box);
+ gtk_box_pack_start (GTK_BOX (vbox), tearable, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), pop_down_widget, TRUE, TRUE, 0);
+ combo_box->priv->tearable = tearable;
+
+ /*
+ * Finish setup
+ */
+ gal_combo_box_set_display (combo_box, display_widget);
+
+ gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), vbox);
+ gtk_widget_show_all (combo_box->priv->frame);
+}
+
+GtkWidget *
+gal_combo_box_new (GtkWidget *display_widget, GtkWidget *optional_popdown)
+{
+ GalComboBox *combo_box;
+
+ g_return_val_if_fail (display_widget != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (display_widget), NULL);
+
+ combo_box = g_object_new (GAL_COMBO_BOX_TYPE, NULL);
+ gal_combo_box_construct (combo_box, display_widget, optional_popdown);
+ return GTK_WIDGET (combo_box);
+}
+
+void
+gal_combo_box_set_arrow_relief (GalComboBox *cc, GtkReliefStyle relief)
+{
+ g_return_if_fail (cc != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (cc));
+
+ gtk_button_set_relief (GTK_BUTTON (cc->priv->arrow_button), relief);
+}
+
+/**
+ * gal_combo_box_set_title
+ * @combo: Combo box
+ * @title: Title
+ *
+ * Set a title to display over the tearoff window.
+ *
+ * FIXME:
+ *
+ * This should really change the title even when the popup is already torn off.
+ * I guess the tearoff window could attach a listener to title change or
+ * something. But I don't think we need the functionality, so I didn't bother
+ * to investigate.
+ */
+void
+gal_combo_box_set_title (GalComboBox *combo,
+ const gchar *title)
+{
+ g_return_if_fail (combo != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo));
+
+ g_object_set_data_full (G_OBJECT (combo), "gtk-combo-title",
+ g_strdup (title), (GDestroyNotify) g_free);
+}
+
+/**
+ * gal_combo_box_set_arrow_sensitive
+ * @combo: Combo box
+ * @sensitive: Sensitivity value
+ *
+ * Toggle the sensitivity of the arrow button
+ */
+
+void
+gal_combo_box_set_arrow_sensitive (GalComboBox *combo,
+ gboolean sensitive)
+{
+ g_return_if_fail (combo != NULL);
+
+ gtk_widget_set_sensitive (combo->priv->arrow_button, sensitive);
+}
+
+/**
+ * gal_combo_box_set_tearable:
+ * @combo: Combo box
+ * @tearable: whether to allow the @combo to be tearable
+ *
+ * controls whether the combo box's pop up widget can be torn off.
+ */
+void
+gal_combo_box_set_tearable (GalComboBox *combo, gboolean tearable)
+{
+ g_return_if_fail (combo != NULL);
+ g_return_if_fail (GAL_IS_COMBO_BOX (combo));
+
+ if (tearable){
+ gtk_widget_show (combo->priv->tearable);
+ } else {
+ gtk_combo_set_tearoff_state (combo, FALSE);
+ gtk_widget_hide (combo->priv->tearable);
+ }
+}
Index: gal/widgets/gal-combo-box.h
===================================================================
RCS file: gal/widgets/gal-combo-box.h
diff -N gal/widgets/gal-combo-box.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-box.h 16 Feb 2004 16:59:22 -0000
@@ -0,0 +1,91 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gtk-combo-box.h - a customizable combobox
+ * Copyright 2000, 2001, Ximian, Inc.
+ *
+ * Authors:
+ * Miguel de Icaza <miguel ximian com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _GAL_COMBO_BOX_H_
+#define _GAL_COMBO_BOX_H_
+
+#include <gtk/gtkhbox.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GAL_COMBO_BOX_TYPE (gal_combo_box_get_type())
+#define GAL_COMBO_BOX(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gal_combo_box_get_type (), GalComboBox)
+#define GAL_COMBO_BOX_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gal_combo_box_get_type (), GalComboBoxClass)
+#define GAL_IS_COMBO_BOX(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gal_combo_box_get_type ())
+
+typedef struct _GalComboBox GalComboBox;
+typedef struct _GalComboBoxPrivate GalComboBoxPrivate;
+typedef struct _GalComboBoxClass GalComboBoxClass;
+
+struct _GalComboBox {
+ GtkHBox hbox;
+ GalComboBoxPrivate *priv;
+};
+
+struct _GalComboBoxClass {
+ GtkHBoxClass parent_class;
+
+ GtkWidget *(*pop_down_widget) (GalComboBox *cbox);
+
+ /*
+ * invoked when the popup has been hidden, if the signal
+ * returns TRUE, it means it should be killed from the
+ */
+ gboolean *(*pop_down_done) (GalComboBox *cbox, GtkWidget *);
+
+ /*
+ * Notification signals.
+ */
+ void (*pre_pop_down) (GalComboBox *cbox);
+ void (*post_pop_hide) (GalComboBox *cbox);
+};
+
+GtkType gal_combo_box_get_type (void);
+void gal_combo_box_construct (GalComboBox *combo_box,
+ GtkWidget *display_widget,
+ GtkWidget *optional_pop_down_widget);
+void gal_combo_box_get_pos (GalComboBox *combo_box, int *x, int *y);
+
+GtkWidget *gal_combo_box_new (GtkWidget *display_widget,
+ GtkWidget *optional_pop_down_widget);
+void gal_combo_box_popup_hide (GalComboBox *combo_box);
+
+void gal_combo_box_set_display (GalComboBox *combo_box,
+ GtkWidget *display_widget);
+
+void gal_combo_box_set_title (GalComboBox *combo,
+ const gchar *title);
+
+void gal_combo_box_set_tearable (GalComboBox *combo,
+ gboolean tearable);
+void gal_combo_box_set_arrow_sensitive (GalComboBox *combo,
+ gboolean sensitive);
+void gal_combo_box_set_arrow_relief (GalComboBox *cc,
+ GtkReliefStyle relief);
+#ifdef __cplusplus
+};
+#endif /* __cplusplus */
+
+#endif /* _GAL_COMBO_BOX_H_ */
Index: gal/widgets/gal-combo-stack.c
===================================================================
RCS file: gal/widgets/gal-combo-stack.c
diff -N gal/widgets/gal-combo-stack.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-stack.c 16 Feb 2004 16:59:23 -0000
@@ -0,0 +1,294 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gtk-combo-stack.c - A combo box for displaying stacks (useful for Undo lists)
+ *
+ * Copyright (C) 2000 �DI Gerg�actus cactus rulez org>
+ *
+ * Authors:
+ * �DI Gerg�actus cactus rulez org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+#include "gal-combo-stack.h"
+#include "gal/util/e-util.h"
+
+#include <stdio.h>
+
+#define PARENT_TYPE GAL_COMBO_BOX_TYPE
+static GtkObjectClass *gal_combo_stack_parent_class;
+
+struct _GalComboStackPrivate {
+ GtkWidget *button;
+ GtkWidget *list;
+ GtkWidget *scrolled_window;
+
+ gint num_items;
+ gint curr_item;
+};
+
+enum {
+ POP,
+ LAST_SIGNAL
+};
+static guint gal_combo_stack_signals [LAST_SIGNAL] = { 0, };
+
+static void
+gal_combo_stack_destroy (GtkObject *object)
+{
+ GalComboStack *combo = GAL_COMBO_STACK (object);
+
+ g_free (combo->priv);
+ combo->priv = NULL;
+
+ GTK_OBJECT_CLASS (gal_combo_stack_parent_class)->destroy (object);
+}
+
+
+static void
+gal_combo_stack_class_init (GtkObjectClass *object_class)
+{
+ object_class->destroy = gal_combo_stack_destroy;
+
+ gal_combo_stack_parent_class = g_type_class_ref (PARENT_TYPE);
+
+ gal_combo_stack_signals [POP] = gtk_signal_new (
+ "pop",
+ GTK_RUN_LAST,
+ E_OBJECT_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GalComboBoxClass, pop_down_done),
+ gtk_marshal_NONE__INT,
+ GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+
+ E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_combo_stack_signals, LAST_SIGNAL);
+}
+
+static void
+gal_combo_stack_init (GalComboStack *object)
+{
+ object->priv = g_new0 (GalComboStackPrivate, 1);
+ object->priv->num_items = 0;
+}
+
+E_MAKE_TYPE (gal_combo_stack,
+ "GalComboStack",
+ GalComboStack,
+ gal_combo_stack_class_init,
+ gal_combo_stack_init,
+ PARENT_TYPE)
+
+static void
+gal_combo_stack_clear_selection (GalComboStack *combo)
+{
+ GList *ptr, *items = gtk_container_children (GTK_CONTAINER (combo->priv->list));
+ for (ptr = items; ptr; ptr = ptr->next)
+ gtk_widget_set_state (GTK_WIDGET (ptr->data), GTK_STATE_NORMAL);
+ g_list_free (items);
+}
+
+static void
+button_cb (GtkWidget *button, gpointer data)
+{
+ gal_combo_stack_pop (GAL_COMBO_STACK (data), 1);
+}
+
+static gboolean
+cb_button_release_event (GtkList *list, GdkEventButton *e, gpointer data)
+{
+ GalComboStack *combo = GAL_COMBO_STACK (data);
+
+ gal_combo_stack_clear_selection (combo);
+ gal_combo_box_popup_hide (GAL_COMBO_BOX (combo));
+
+ if (combo->priv->curr_item > 0) {
+ gint dummy, w, h;
+ gdk_window_get_geometry (e->window, &dummy, &dummy, &w, &h, &dummy);
+ if (0 <= e->x && e->x < w && 0 <= e->y && e->y < h)
+ gal_combo_stack_pop (combo, combo->priv->curr_item);
+ }
+ gtk_list_end_drag_selection (list);
+
+ return TRUE;
+}
+
+static void
+list_select_cb (GtkList *list, GtkWidget *child, gpointer data)
+{
+ GalComboStack *combo = GAL_COMBO_STACK (data);
+ GList *ptr, *items = gtk_container_children (GTK_CONTAINER (list));
+ guint i = 0;
+
+ gal_combo_stack_clear_selection (combo);
+
+ for (ptr = items; ptr != NULL ; i++ ) {
+ gtk_widget_set_state (GTK_WIDGET (ptr->data),
+ GTK_STATE_SELECTED);
+ ptr = (ptr->data != child) ? ptr->next : NULL;
+ }
+ g_list_free (items);
+
+ combo->priv->curr_item = i;
+}
+
+static void
+gal_combo_stack_construct (GalComboStack *combo,
+ const gchar *stock_name,
+ gboolean const is_scrolled)
+{
+ GtkWidget *button, *list, *scroll, *display_widget, *pixmap;
+
+ button = combo->priv->button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
+
+ list = combo->priv->list = gtk_list_new ();
+
+ /* Create the button */
+ pixmap = gtk_image_new_from_stock (
+ stock_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
+ gtk_widget_show (pixmap);
+ gtk_container_add (GTK_CONTAINER (button), pixmap);
+ gtk_widget_set_usize (GTK_WIDGET (pixmap), 24, 22);
+
+ if (is_scrolled) {
+ display_widget = scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_add_with_viewport (
+ GTK_SCROLLED_WINDOW(scroll), list);
+ gtk_container_set_focus_hadjustment (
+ GTK_CONTAINER (list),
+ gtk_scrolled_window_get_hadjustment (
+ GTK_SCROLLED_WINDOW (scroll)));
+ gtk_container_set_focus_vadjustment (
+ GTK_CONTAINER (list),
+ gtk_scrolled_window_get_vadjustment (
+ GTK_SCROLLED_WINDOW (scroll)));
+ gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
+ } else
+ display_widget = list;
+
+ /* Set up the dropdown list */
+ gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
+ g_signal_connect (list, "select-child",
+ G_CALLBACK (list_select_cb),
+ (gpointer) combo);
+ g_signal_connect (list, "button_release_event",
+ G_CALLBACK (cb_button_release_event),
+ (gpointer) combo);
+
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (button_cb),
+ (gpointer) combo);
+
+ gtk_widget_show (display_widget);
+ gtk_widget_show (button);
+ gal_combo_box_construct (GAL_COMBO_BOX (combo), button, display_widget);
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
+}
+
+GtkWidget*
+gal_combo_stack_new (const gchar *stock,
+ gboolean const is_scrolled)
+{
+ GalComboStack *combo;
+
+ combo = g_object_new (GAL_COMBO_STACK_TYPE, NULL);
+ gal_combo_stack_construct (combo, stock, is_scrolled);
+
+ return GTK_WIDGET (combo);
+}
+
+void
+gal_combo_stack_push_item (GalComboStack *combo,
+ const gchar *item)
+{
+ GtkWidget *listitem;
+
+ g_return_if_fail (item != NULL);
+
+ combo->priv->num_items++;
+
+ listitem = gtk_list_item_new_with_label (item);
+ gtk_widget_show (listitem);
+
+ gtk_list_prepend_items (GTK_LIST (combo->priv->list),
+ g_list_prepend (NULL, listitem));
+/* gtk_list_unselect_all (GTK_LIST (combo->priv->list)); */
+ gal_combo_stack_clear_selection (combo);
+
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), TRUE);
+}
+
+void
+gal_combo_stack_pop (GalComboStack *combo, gint num)
+{
+ g_signal_emit_by_name (combo, "pop", num);
+}
+
+void
+gal_combo_stack_remove_top (GalComboStack *combo, gint num)
+{
+ gint i;
+ GList *child, *children;
+ GtkWidget *list = combo->priv->list;
+
+ g_return_if_fail (combo->priv->num_items != 0);
+
+ if (num > combo->priv->num_items)
+ num = combo->priv->num_items;
+
+ children = child = gtk_container_children (GTK_CONTAINER (list));
+ for (i = 0; i < num; i++) {
+ gtk_container_remove (GTK_CONTAINER (list), child->data);
+ child = g_list_next (child);
+ }
+ g_list_free (children);
+
+ gal_combo_stack_clear_selection (combo);
+
+ combo->priv->num_items -= num;
+ combo->priv->curr_item = -1;
+ if (!combo->priv->num_items)
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
+}
+
+void
+gal_combo_stack_clear (GalComboStack *combo)
+{
+ combo->priv->num_items = 0;
+ gtk_list_clear_items (GTK_LIST (combo->priv->list), 0, -1);
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
+}
+
+/*
+ * Make sure stack is not deeper than @n elements.
+ *
+ * (Think undo/redo where we don't want to use too much memory.)
+ */
+void
+gal_combo_stack_truncate (GalComboStack *combo, int n)
+{
+ if (combo->priv->num_items > n) {
+ combo->priv->num_items = n;
+
+ gtk_list_clear_items (GTK_LIST (combo->priv->list), n, -1);
+ if (n == 0)
+ gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
+ }
+}
Index: gal/widgets/gal-combo-stack.h
===================================================================
RCS file: gal/widgets/gal-combo-stack.h
diff -N gal/widgets/gal-combo-stack.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-stack.h 16 Feb 2004 16:59:23 -0000
@@ -0,0 +1,69 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gal-combo-stack.h - A combo box for displaying stacks (useful for Undo lists)
+ *
+ * Copyright (C) 2000 �DI Gerg�actus cactus rulez org>
+ *
+ * Authors:
+ * �DI Gerg�actus cactus rulez org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _GAL_COMBO_STACK_H
+#define _GAL_COMBO_STACK_H
+
+#include <gtk/gtkwidget.h>
+#include "gal-combo-box.h"
+
+G_BEGIN_DECLS
+
+#define GAL_COMBO_STACK_TYPE (gal_combo_stack_get_type ())
+#define GAL_COMBO_STACK(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gal_combo_stack_get_type (), GalComboStack)
+#define GAL_COMBO_STACK_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gal_combo_stack_get_type (), GalComboTextClass)
+#define GAL_IS_COMBO_STACK(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gal_combo_stack_get_type ())
+
+typedef struct _GalComboStack GalComboStack;
+typedef struct _GalComboStackPrivate GalComboStackPrivate;
+typedef struct _GalComboStackClass GalComboStackClass;
+
+struct _GalComboStack {
+ GalComboBox parent;
+
+ GalComboStackPrivate *priv;
+};
+
+struct _GalComboStackClass {
+ GalComboBoxClass parent_class;
+};
+
+
+GtkType gal_combo_stack_get_type (void);
+GtkWidget *gal_combo_stack_new (const gchar *stock_name,
+ gboolean const is_scrolled);
+
+void gal_combo_stack_push_item (GalComboStack *combo_stack,
+ const gchar *item);
+
+void gal_combo_stack_remove_top (GalComboStack *combo_stack,
+ gint num);
+void gal_combo_stack_pop (GalComboStack *combo_stack,
+ gint num);
+void gal_combo_stack_clear (GalComboStack *combo_stack);
+void gal_combo_stack_truncate (GalComboStack *combo, int n);
+
+G_END_DECLS
+
+#endif
Index: gal/widgets/gal-combo-text.c
===================================================================
RCS file: gal/widgets/gal-combo-text.c
diff -N gal/widgets/gal-combo-text.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-text.c 16 Feb 2004 16:59:24 -0000
@@ -0,0 +1,433 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gtk-combo-text.c - A combo box for selecting from a list.
+ * Copyright 2000, 2001, Ximian, Inc.
+ *
+ * Authors:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <ctype.h>
+#include <gal/util/e-util.h>
+#include <gtk/gtksignal.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtklist.h>
+#include <gtk/gtkscrolledwindow.h>
+#include "gal-combo-text.h"
+
+#define PARENT_TYPE GAL_COMBO_BOX_TYPE
+static GtkObjectClass *gal_combo_text_parent_class;
+
+static gboolean cb_pop_down (GtkWidget *w, GtkWidget *pop_down,
+ gpointer dummy);
+
+static void list_unselect_cb (GtkWidget *list, GtkWidget *child,
+ gpointer data);
+
+static void update_list_selection (GalComboText *ct, const gchar *text);
+
+static void
+gal_combo_text_destroy (GtkObject *object)
+{
+ GalComboText *ct = GAL_COMBO_TEXT (object);
+
+ if (ct->elements != NULL) {
+ g_hash_table_destroy (ct->elements);
+ ct->elements = NULL;
+ }
+ if (ct->list != NULL) {
+ g_signal_handlers_disconnect_matched (ct,
+ G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL,
+ cb_pop_down, NULL);
+
+ g_signal_handlers_disconnect_matched (ct->list,
+ G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL,
+ list_unselect_cb, ct);
+ ct->list = NULL;
+ }
+
+ (*gal_combo_text_parent_class->destroy) (object);
+}
+
+static void
+gal_combo_text_class_init (GtkObjectClass *object_class)
+{
+ object_class->destroy = &gal_combo_text_destroy;
+ gal_combo_text_parent_class = g_type_class_ref (PARENT_TYPE);
+}
+
+static void
+gal_combo_text_init (GalComboText *object)
+{
+}
+
+E_MAKE_TYPE (gal_combo_text,
+ "GalComboText",
+ GalComboText,
+ gal_combo_text_class_init,
+ gal_combo_text_init,
+ PARENT_TYPE)
+
+static gint
+strcase_equal (gconstpointer v, gconstpointer v2)
+{
+ return g_strcasecmp ((const gchar*) v, (const gchar*)v2) == 0;
+}
+
+
+/*
+ * a char* hash function from ASU
+ *
+ * This is cut/paste from gutils.c
+ * We've got to do this, because this widget will soon move out of the
+ * Gnumeric source and into a separate library.
+ */
+static guint
+strcase_hash (gconstpointer v)
+{
+ const unsigned char *s = (const unsigned char *)v;
+ const unsigned char *p;
+ guint h = 0, g;
+
+ for(p = s; *p != '\0'; p += 1) {
+ h = ( h << 4 ) + tolower (*p);
+ if ( ( g = h & 0xf0000000 ) ) {
+ h = h ^ (g >> 24);
+ h = h ^ g;
+ }
+ }
+
+ return h /* % M */;
+}
+
+/**
+ * gal_combo_text_set_case_sensitive
+ * @combo_text: ComboText widget
+ * @val: make case sensitive if TRUE
+ *
+ * Specifies whether the text entered into the GtkEntry field and the text
+ * in the list items is case sensitive. Because the values are stored in a
+ * hash, it is not legal to change case sensitivity when the list contains
+ * elements.
+ *
+ * Returns: The function returns -1 if request could not be honored. On
+ * success, it returns 0.
+ */
+gint
+gal_combo_text_set_case_sensitive (GalComboText *combo, gboolean val)
+{
+ if (combo->elements
+ && g_hash_table_size (combo->elements) > 0
+ && val != combo->case_sensitive)
+ return -1;
+ else {
+ combo->case_sensitive = val;
+ if (val != combo->case_sensitive) {
+ GHashFunc hashfunc;
+ GCompareFunc comparefunc;
+
+ g_hash_table_destroy (combo->elements);
+ if (combo->case_sensitive) {
+ hashfunc = g_str_hash;
+ comparefunc = g_str_equal;
+ } else {
+ hashfunc = strcase_hash;
+ comparefunc = strcase_equal;
+ }
+ combo->elements = g_hash_table_new (hashfunc,
+ comparefunc);
+ }
+ return 0;
+ }
+}
+
+static void
+entry_activate_cb (GtkWidget *entry, gpointer data)
+{
+ GalComboText *combo = GAL_COMBO_TEXT (data);
+
+ update_list_selection (combo,
+ gtk_entry_get_text (GTK_ENTRY (combo->entry)));
+}
+
+
+static void
+list_select_cb (GtkWidget *list, GtkWidget *child, gpointer data)
+{
+ GalComboText *combo = GAL_COMBO_TEXT (data);
+ GtkEntry *entry = GTK_ENTRY (combo->entry);
+ gchar *value = (gchar*) g_object_get_data (G_OBJECT (child), "value");
+
+ g_return_if_fail (entry && value);
+
+ if (combo->cached_entry == child)
+ combo->cached_entry = NULL;
+
+ gtk_entry_set_text (entry, value);
+ gtk_signal_handler_block_by_func (GTK_OBJECT (entry),
+ GTK_SIGNAL_FUNC (entry_activate_cb),
+ (gpointer) combo);
+ g_signal_emit_by_name (entry, "activate");
+ gtk_signal_handler_unblock_by_func (GTK_OBJECT (entry),
+ GTK_SIGNAL_FUNC (entry_activate_cb),
+ (gpointer) combo);
+
+ gal_combo_box_popup_hide (GAL_COMBO_BOX (data));
+}
+
+static void
+list_unselect_cb (GtkWidget *list, GtkWidget *child, gpointer data)
+{
+ if (GTK_WIDGET_VISIBLE (list)) /* Undo interactive unselect */
+ gtk_list_select_child (GTK_LIST (list), child);
+}
+
+static void
+cb_toggle (GtkWidget *child, gpointer data)
+{
+ GalComboText *ct = GAL_COMBO_TEXT (data);
+
+ gtk_list_select_child (GTK_LIST (ct->list), child);
+}
+
+void
+gal_combo_text_select_item (GalComboText *ct, int elem)
+{
+ gtk_list_select_item (GTK_LIST(ct->list), elem);
+}
+
+static void
+update_list_selection (GalComboText *ct, const gchar *text)
+{
+ gpointer candidate;
+ GtkWidget *child;
+
+ gtk_signal_handler_block_by_func (GTK_OBJECT (ct->list),
+ GTK_SIGNAL_FUNC (list_select_cb),
+ (gpointer) ct);
+ gtk_signal_handler_block_by_func (GTK_OBJECT (ct->list),
+ GTK_SIGNAL_FUNC (list_unselect_cb),
+ (gpointer) ct);
+
+ gtk_list_unselect_all (GTK_LIST (ct->list));
+ candidate = g_hash_table_lookup (ct->elements, (gconstpointer) text);
+ if (candidate && GTK_IS_WIDGET (candidate)) {
+ child = GTK_WIDGET (candidate);
+ gtk_list_select_child (GTK_LIST (ct->list), child);
+ gtk_widget_grab_focus (child);
+ }
+ gtk_signal_handler_unblock_by_func (GTK_OBJECT (ct->list),
+ GTK_SIGNAL_FUNC (list_select_cb),
+ (gpointer) ct);
+ gtk_signal_handler_unblock_by_func (GTK_OBJECT (ct->list),
+ GTK_SIGNAL_FUNC (list_unselect_cb),
+ (gpointer) ct);
+}
+
+void
+gal_combo_text_set_text (GalComboText *ct, const gchar *text)
+{
+ gtk_entry_set_text (GTK_ENTRY (ct->entry), text);
+ update_list_selection (ct, text);
+}
+
+/*
+ * We can't just cache the old widget state on entry: If the pointer is
+ * dragged, we receive two enter-notify-events, and the original cached
+ * value would be overwritten with the GTK_STATE_ACTIVE we just set.
+ *
+ * However, we know that the gtklist only uses GTK_STATE_SELECTED and
+ * GTK_STATE_NORMAL. We're OK if we only cache those two.
+ */
+static gboolean
+cb_enter (GtkWidget *w, GdkEventCrossing *event,
+ gpointer user)
+{
+ GalComboText *ct = user;
+ GtkStateType state = GTK_WIDGET_STATE (w);
+
+ if (state == GTK_STATE_NORMAL || state == GTK_STATE_SELECTED) {
+ ct->cached_entry = w;
+ ct->cache_mouse_state = state;
+ }
+ if (state != GTK_STATE_SELECTED)
+ gtk_widget_set_state (w, GTK_STATE_ACTIVE);
+
+ return TRUE;
+}
+static gboolean
+cb_exit (GtkWidget *w, GdkEventCrossing *event,
+ gpointer user)
+{
+ GalComboText *ct = user;
+
+ if (ct->cached_entry == w)
+ gtk_widget_set_state (w, ct->cache_mouse_state);
+
+ return TRUE;
+}
+
+static gboolean
+cb_pop_down (GtkWidget *w, GtkWidget *pop_down, gpointer dummy)
+{
+ GalComboText *ct = GAL_COMBO_TEXT (w);
+
+ if (ct->cached_entry)
+ gtk_widget_set_state (ct->cached_entry, ct->cache_mouse_state);
+ ct->cached_entry = NULL;
+
+ return FALSE;
+}
+
+typedef struct {
+ GalComboText *ct;
+ gchar *value;
+} WeakRefClosure;
+
+static void
+cb_remove_from_hash (gpointer data, GObject *where_object_was)
+{
+ WeakRefClosure *closure = data;
+
+ if (closure->ct->elements)
+ g_hash_table_remove (closure->ct->elements, closure->value);
+
+ g_free (closure->value);
+ g_free (closure);
+}
+
+void
+gal_combo_text_add_item (GalComboText *ct,
+ const gchar *item,
+ const gchar *value)
+{
+ WeakRefClosure *weak_ref_closure;
+ GtkWidget *listitem;
+ gchar *value_copy;
+
+ g_return_if_fail (item);
+
+ if (!value)
+ value = item;
+
+ value_copy = g_strdup (value);
+
+ listitem = gtk_list_item_new_with_label (item);
+ gtk_widget_show (listitem);
+
+ g_object_set_data_full (G_OBJECT (listitem), "value",
+ value_copy, g_free);
+ g_signal_connect (listitem, "enter-notify-event",
+ G_CALLBACK (cb_enter),
+ (gpointer) ct);
+ g_signal_connect (listitem, "leave-notify-event",
+ G_CALLBACK (cb_exit),
+ (gpointer) ct);
+ g_signal_connect (listitem, "toggle",
+ G_CALLBACK (cb_toggle),
+ (gpointer) ct);
+
+ gtk_container_add (GTK_CONTAINER (ct->list),
+ listitem);
+
+ g_hash_table_insert (ct->elements, (gpointer)value_copy,
+ (gpointer) listitem);
+
+ weak_ref_closure = g_new (WeakRefClosure, 1);
+ weak_ref_closure->ct = ct;
+ weak_ref_closure->value = g_strdup (value_copy);
+
+ g_object_weak_ref (G_OBJECT (listitem),
+ cb_remove_from_hash,
+ weak_ref_closure);
+}
+
+static void
+cb_list_mapped (GtkWidget *widget, gpointer user_data)
+{
+ GtkList *list = GTK_LIST (widget);
+
+ if (g_list_length (list->selection) > 0)
+ gtk_widget_grab_focus (GTK_WIDGET ((list->selection->data)));
+}
+
+void
+gal_combo_text_construct (GalComboText *ct, gboolean const is_scrolled)
+{
+ GtkWidget *entry, *list, *scroll, *display_widget;
+
+ ct->case_sensitive = FALSE;
+ ct->elements = g_hash_table_new (&strcase_hash,
+ &strcase_equal);
+
+ /* Probably irrelevant, but lets be careful */
+ ct->cache_mouse_state = GTK_STATE_NORMAL;
+ ct->cached_entry = NULL;
+
+ entry = ct->entry = gtk_entry_new ();
+ list = ct->list = gtk_list_new ();
+ if (is_scrolled) {
+ display_widget = scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
+ GTK_POLICY_NEVER,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_add_with_viewport (
+ GTK_SCROLLED_WINDOW(scroll), list);
+ gtk_container_set_focus_hadjustment (
+ GTK_CONTAINER (list),
+ gtk_scrolled_window_get_hadjustment (
+ GTK_SCROLLED_WINDOW (scroll)));
+ gtk_container_set_focus_vadjustment (
+ GTK_CONTAINER (list),
+ gtk_scrolled_window_get_vadjustment (
+ GTK_SCROLLED_WINDOW (scroll)));
+ gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
+ } else
+ display_widget = list;
+
+ g_signal_connect (entry, "activate",
+ G_CALLBACK (entry_activate_cb),
+ ct);
+ g_signal_connect (list, "select-child",
+ G_CALLBACK (list_select_cb),
+ ct);
+ g_signal_connect (list, "unselect-child",
+ G_CALLBACK (list_unselect_cb),
+ ct);
+ g_signal_connect (list, "map",
+ G_CALLBACK (cb_list_mapped), NULL);
+
+ gtk_widget_show (display_widget);
+ gtk_widget_show (entry);
+ gal_combo_box_construct (GAL_COMBO_BOX (ct), entry, display_widget);
+ g_signal_connect (ct, "pop_down_done",
+ G_CALLBACK (cb_pop_down), NULL);
+}
+
+GtkWidget*
+gal_combo_text_new (gboolean const is_scrolled)
+{
+ GalComboText *ct;
+
+ ct = g_object_new (GAL_COMBO_TEXT_TYPE, NULL);
+ gal_combo_text_construct (ct, is_scrolled);
+ return GTK_WIDGET (ct);
+}
+
Index: gal/widgets/gal-combo-text.h
===================================================================
RCS file: gal/widgets/gal-combo-text.h
diff -N gal/widgets/gal-combo-text.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gal/widgets/gal-combo-text.h 16 Feb 2004 16:59:24 -0000
@@ -0,0 +1,76 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * gal-combo-text.h - A combo box for selecting from a list.
+ * Copyright 2000, 2001, Ximian, Inc.
+ *
+ * Authors:
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License, version 2, as published by the Free Software Foundation.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+#ifndef _GAL_COMBO_TEXT_H
+#define _GAL_COMBO_TEXT_H
+
+#include <gal/widgets/gal-combo-box.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GAL_COMBO_TEXT_TYPE (gal_combo_text_get_type ())
+#define GAL_COMBO_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gal_combo_text_get_type (), GalComboText)
+#define GAL_COMBO_TEXT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gal_combo_text_get_type (), GalComboTextClass)
+#define GAL_IS_COMBO_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gal_combo_text_get_type ())
+
+typedef struct _GalComboText GalComboText;
+/* typedef struct _GalComboTextPrivate GalComboTextPrivate;*/
+typedef struct _GalComboTextClass GalComboTextClass;
+
+struct _GalComboText {
+ GalComboBox parent;
+
+ GtkWidget *entry;
+ GtkWidget *list;
+ GtkWidget *scrolled_window;
+ GtkStateType cache_mouse_state;
+ GtkWidget *cached_entry;
+ gboolean case_sensitive;
+ GHashTable*elements;
+};
+
+struct _GalComboTextClass {
+ GalComboBoxClass parent_class;
+};
+
+
+GtkType gal_combo_text_get_type (void);
+GtkWidget *gal_combo_text_new (gboolean const is_scrolled);
+void gal_combo_text_construct (GalComboText *ct, gboolean const is_scrolled);
+
+gint gal_combo_text_set_case_sensitive (GalComboText *combo_text,
+ gboolean val);
+void gal_combo_text_select_item (GalComboText *combo_text,
+ int elem);
+void gal_combo_text_set_text (GalComboText *combo_text,
+ const gchar *text);
+void gal_combo_text_add_item (GalComboText *combo_text,
+ const gchar *item,
+ const gchar *value);
+
+#ifdef __cplusplus
+};
+#endif /* __cplusplus */
+
+#endif
Index: gal/widgets/gtk-combo-box.c
===================================================================
RCS file: gal/widgets/gtk-combo-box.c
diff -N gal/widgets/gtk-combo-box.c
--- gal/widgets/gtk-combo-box.c 7 May 2003 15:44:36 -0000 1.26
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,834 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-box.c - a customizable combobox
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel gnu org)
- * Adrian E Feiguin (feiguin ifir edu ar)
- * Paolo Molnaro (lupus debian org).
- * Jon K Hellan (hellan acm org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkarrow.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtktearoffmenuitem.h>
-#include <gdk/gdkkeysyms.h>
-#include "gtk-combo-box.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE GTK_TYPE_HBOX
-static GObjectClass *gtk_combo_box_parent_class;
-
-static int gtk_combo_toggle_pressed (GtkToggleButton *tbutton,
- GtkComboBox *combo_box);
-static void gtk_combo_popup_tear_off (GtkComboBox *combo,
- gboolean set_position);
-static void gtk_combo_set_tearoff_state (GtkComboBox *combo,
- gboolean torn_off);
-static void gtk_combo_popup_reparent (GtkWidget *popup, GtkWidget *new_parent,
- gboolean unrealize);
-static gboolean cb_popup_delete (GtkWidget *w, GdkEventAny *event,
- GtkComboBox *combo);
-static void gtk_combo_tearoff_bg_copy (GtkComboBox *combo);
-
-enum {
- POP_DOWN_WIDGET,
- POP_DOWN_DONE,
- PRE_POP_DOWN,
- POST_POP_HIDE,
- LAST_SIGNAL
-};
-
-static guint gtk_combo_box_signals [LAST_SIGNAL] = { 0, };
-
-struct _GtkComboBoxPrivate {
- GtkWidget *pop_down_widget;
- GtkWidget *display_widget;
-
- /*
- * Internal widgets used to implement the ComboBox
- */
- GtkWidget *frame;
- GtkWidget *arrow_button;
-
- GtkWidget *toplevel; /* Popup's toplevel when not torn off */
- GtkWidget *tearoff_window; /* Popup's toplevel when torn off */
- guint torn_off;
-
- GtkWidget *tearable; /* The tearoff "button" */
- GtkWidget *popup; /* Popup */
-
- /*
- * Closure for invoking the callbacks above
- */
- void *closure;
-};
-
-static void
-gtk_combo_box_finalize (GObject *object)
-{
- GtkComboBox *combo_box = GTK_COMBO_BOX (object);
-
- g_free (combo_box->priv);
-
- gtk_combo_box_parent_class->finalize (object);
-}
-
-static void
-gtk_combo_box_destroy (GtkObject *object)
-{
- GtkObjectClass *klass = (GtkObjectClass *)gtk_combo_box_parent_class;
- GtkComboBox *combo_box = GTK_COMBO_BOX (object);
-
- if (combo_box->priv->toplevel) {
- gtk_object_destroy (GTK_OBJECT (combo_box->priv->toplevel));
- combo_box->priv->toplevel = NULL;
- }
-
- if (combo_box->priv->tearoff_window) {
- gtk_object_destroy (GTK_OBJECT (combo_box->priv->tearoff_window));
- combo_box->priv->tearoff_window = NULL;
- }
-
- if (klass->destroy)
- klass->destroy (object);
-}
-
-static gboolean
-gtk_combo_box_mnemonic_activate (GtkWidget *w, gboolean group_cycling)
-{
- GtkComboBox *combo_box = GTK_COMBO_BOX (w);
- gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON (combo_box->priv->arrow_button), TRUE);
- return TRUE;
-}
-
-static void
-gtk_combo_box_class_init (GObjectClass *object_class)
-{
- GtkWidgetClass *widget_class = (GtkWidgetClass *)object_class;
- gtk_combo_box_parent_class = g_type_class_peek_parent (object_class);
-
- object_class->finalize = gtk_combo_box_finalize;
- widget_class->mnemonic_activate = gtk_combo_box_mnemonic_activate;
- ((GtkObjectClass *)object_class)->destroy = gtk_combo_box_destroy;
-
- gtk_combo_box_signals [POP_DOWN_WIDGET] = g_signal_new (
- "pop_down_widget",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkComboBoxClass, pop_down_widget),
- NULL, NULL,
- e_marshal_POINTER__NONE,
- G_TYPE_POINTER, 0, G_TYPE_NONE);
-
- gtk_combo_box_signals [POP_DOWN_DONE] = g_signal_new (
- "pop_down_done",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkComboBoxClass, pop_down_done),
- NULL, NULL,
- e_marshal_BOOLEAN__OBJECT,
- G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT);
-
- gtk_combo_box_signals [PRE_POP_DOWN] = g_signal_new (
- "pre_pop_down",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkComboBoxClass, pre_pop_down),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- gtk_combo_box_signals [POST_POP_HIDE] = g_signal_new (
- "post_pop_hide",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkComboBoxClass, post_pop_hide),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-deactivate_arrow (GtkComboBox *combo_box)
-{
- GtkToggleButton *arrow;
-
- arrow = GTK_TOGGLE_BUTTON (combo_box->priv->arrow_button);
- g_signal_handlers_block_matched (arrow,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- gtk_combo_toggle_pressed, combo_box);
-
- gtk_toggle_button_set_active (arrow, FALSE);
-
- g_signal_handlers_unblock_matched (arrow,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- gtk_combo_toggle_pressed, combo_box);
-}
-
-/**
- * gtk_combo_box_popup_hide_unconditional
- * @combo_box: Combo box
- *
- * Hide popup, whether or not it is torn off.
- */
-static void
-gtk_combo_box_popup_hide_unconditional (GtkComboBox *combo_box)
-{
- gboolean popup_info_destroyed = FALSE;
-
- g_return_if_fail (combo_box != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
-
- gtk_widget_hide (combo_box->priv->toplevel);
- gtk_widget_hide (combo_box->priv->popup);
- if (combo_box->priv->torn_off) {
- GTK_TEAROFF_MENU_ITEM (combo_box->priv->tearable)->torn_off
- = FALSE;
- gtk_combo_set_tearoff_state (combo_box, FALSE);
- }
-
- gtk_grab_remove (combo_box->priv->toplevel);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- g_object_ref (combo_box->priv->pop_down_widget);
- g_signal_emit (combo_box,
- gtk_combo_box_signals [POP_DOWN_DONE], 0,
- combo_box->priv->pop_down_widget, &popup_info_destroyed);
-
- if (popup_info_destroyed){
- gtk_container_remove (
- GTK_CONTAINER (combo_box->priv->frame),
- combo_box->priv->pop_down_widget);
- combo_box->priv->pop_down_widget = NULL;
- }
- g_object_unref (combo_box->priv->pop_down_widget);
- deactivate_arrow (combo_box);
-
- g_signal_emit (combo_box, gtk_combo_box_signals [POST_POP_HIDE], 0);
-}
-
-/**
- * gtk_combo_box_popup_hide:
- * @combo_box: Combo box
- *
- * Hide popup, but not when it is torn off.
- * This is the external interface - for subclasses and apps which expect a
- * regular combo which doesn't do tearoffs.
- */
-void
-gtk_combo_box_popup_hide (GtkComboBox *combo_box)
-{
- if (!combo_box->priv->torn_off)
- gtk_combo_box_popup_hide_unconditional (combo_box);
- else if (GTK_WIDGET_VISIBLE (combo_box->priv->toplevel)) {
- /* Both popup and tearoff window present. Get rid of just
- the popup shell. */
- gtk_combo_popup_tear_off (combo_box, FALSE);
- deactivate_arrow (combo_box);
- }
-}
-
-/*
- * Find best location for displaying
- */
-void
-gtk_combo_box_get_pos (GtkComboBox *combo_box, int *x, int *y)
-{
- GtkWidget *wcombo = GTK_WIDGET (combo_box);
- int ph, pw;
-
- gdk_window_get_origin (wcombo->window, x, y);
- *y += wcombo->allocation.height + wcombo->allocation.y;
- *x += wcombo->allocation.x;
-
- ph = combo_box->priv->popup->allocation.height;
- pw = combo_box->priv->popup->allocation.width;
-
- if ((*y + ph) > gdk_screen_height ())
- *y = gdk_screen_height () - ph;
-
- if ((*x + pw) > gdk_screen_width ())
- *x = gdk_screen_width () - pw;
-}
-
-static void
-gtk_combo_box_popup_display (GtkComboBox *combo_box)
-{
- int x, y;
-
- g_return_if_fail (combo_box != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
-
- /*
- * If we have no widget to display on the popdown,
- * create it
- */
- if (!combo_box->priv->pop_down_widget){
- GtkWidget *pw = NULL;
-
- g_signal_emit (combo_box,
- gtk_combo_box_signals [POP_DOWN_WIDGET], 0, &pw);
- g_assert (pw != NULL);
- combo_box->priv->pop_down_widget = pw;
- gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), pw);
- }
-
- g_signal_emit (combo_box, gtk_combo_box_signals [PRE_POP_DOWN], 0);
-
- if (combo_box->priv->torn_off) {
- /* To give the illusion that tearoff still displays the
- * popup, we copy the image in the popup window to the
- * background. Thus, it won't be blank after reparenting */
- gtk_combo_tearoff_bg_copy (combo_box);
-
- /* We force an unrealize here so that we don't trigger
- * redrawing/ clearing code - we just want to reveal our
- * backing pixmap.
- */
- gtk_combo_popup_reparent (combo_box->priv->popup,
- combo_box->priv->toplevel, TRUE);
- }
-
- gtk_combo_box_get_pos (combo_box, &x, &y);
-
- gtk_widget_set_uposition (combo_box->priv->toplevel, x, y);
- gtk_widget_realize (combo_box->priv->popup);
- gtk_widget_show (combo_box->priv->popup);
- gtk_widget_realize (combo_box->priv->toplevel);
- gtk_widget_show (combo_box->priv->toplevel);
-
- gtk_grab_add (combo_box->priv->toplevel);
- gdk_pointer_grab (combo_box->priv->toplevel->window, TRUE,
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK,
- NULL, NULL, GDK_CURRENT_TIME);
-}
-
-static int
-gtk_combo_toggle_pressed (GtkToggleButton *tbutton, GtkComboBox *combo_box)
-{
- if (tbutton->active)
- gtk_combo_box_popup_display (combo_box);
- else
- gtk_combo_box_popup_hide_unconditional (combo_box);
-
- return TRUE;
-}
-
-static gint
-gtk_combo_box_button_press (GtkWidget *widget, GdkEventButton *event, GtkComboBox *combo_box)
-{
- GtkWidget *child;
-
- child = gtk_get_event_widget ((GdkEvent *) event);
- if (child != widget){
- while (child){
- if (child == widget)
- return FALSE;
- child = child->parent;
- }
- }
-
- gtk_combo_box_popup_hide (combo_box);
- return TRUE;
-}
-
-/**
- * gtk_combo_box_key_press
- * @widget: Widget
- * @event: Event
- * @combo_box: Combo box
- *
- * Key press handler which dismisses popup on escape.
- * Popup is dismissed whether or not popup is torn off.
- */
-static gint
-gtk_combo_box_key_press (GtkWidget *widget, GdkEventKey *event,
- GtkComboBox *combo_box)
-{
- if (event->keyval == GDK_Escape) {
- gtk_combo_box_popup_hide_unconditional (combo_box);
- return TRUE;
- } else
- return FALSE;
-}
-
-static void
-cb_state_change (GtkWidget *widget, GtkStateType old_state, GtkComboBox *combo_box)
-{
- GtkStateType const new_state = GTK_WIDGET_STATE(widget);
- gtk_widget_set_state (combo_box->priv->display_widget, new_state);
-}
-
-static void
-gtk_combo_box_init (GtkComboBox *combo_box)
-{
- GtkWidget *arrow;
- GdkCursor *cursor;
-
- combo_box->priv = g_new0 (GtkComboBoxPrivate, 1);
-
- /*
- * Create the arrow
- */
- combo_box->priv->arrow_button = gtk_toggle_button_new ();
- gtk_button_set_relief (GTK_BUTTON (combo_box->priv->arrow_button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (combo_box->priv->arrow_button, GTK_CAN_FOCUS);
-
- arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
- gtk_container_add (GTK_CONTAINER (combo_box->priv->arrow_button), arrow);
- gtk_box_pack_end (GTK_BOX (combo_box), combo_box->priv->arrow_button, FALSE, FALSE, 0);
- g_signal_connect (combo_box->priv->arrow_button, "toggled",
- G_CALLBACK (gtk_combo_toggle_pressed), combo_box);
- gtk_widget_show_all (combo_box->priv->arrow_button);
-
- /*
- * prelight the display widget when mousing over the arrow.
- */
- g_signal_connect (combo_box->priv->arrow_button, "state-changed",
- G_CALLBACK (cb_state_change), combo_box);
-
- /*
- * The pop-down container
- */
-
- combo_box->priv->toplevel = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_ref (combo_box->priv->toplevel);
- gtk_object_sink (GTK_OBJECT (combo_box->priv->toplevel));
- gtk_window_set_policy (GTK_WINDOW (combo_box->priv->toplevel),
- FALSE, TRUE, FALSE);
-
- combo_box->priv->popup = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (combo_box->priv->toplevel),
- combo_box->priv->popup);
- gtk_widget_show (combo_box->priv->popup);
-
- gtk_widget_realize (combo_box->priv->popup);
- cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
- gdk_window_set_cursor (combo_box->priv->popup->window, cursor);
- gdk_cursor_destroy (cursor);
-
- combo_box->priv->torn_off = FALSE;
- combo_box->priv->tearoff_window = NULL;
-
- combo_box->priv->frame = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (combo_box->priv->popup),
- combo_box->priv->frame);
- gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->frame), GTK_SHADOW_OUT);
-
- g_signal_connect (combo_box->priv->toplevel, "button_press_event",
- G_CALLBACK (gtk_combo_box_button_press), combo_box);
- g_signal_connect (combo_box->priv->toplevel, "key_press_event",
- G_CALLBACK (gtk_combo_box_key_press), combo_box);
-}
-
-E_MAKE_TYPE (gtk_combo_box,
- "MyGtkComboBox",
- GtkComboBox,
- gtk_combo_box_class_init,
- gtk_combo_box_init,
- PARENT_TYPE)
-
-/**
- * gtk_combo_box_set_display:
- * @combo_box: the Combo Box to modify
- * @display_widget: The widget to be displayed
-
- * Sets the displayed widget for the @combo_box to be @display_widget
- */
-void
-gtk_combo_box_set_display (GtkComboBox *combo_box, GtkWidget *display_widget)
-{
- g_return_if_fail (combo_box != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
- g_return_if_fail (display_widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (display_widget));
-
- if (combo_box->priv->display_widget &&
- combo_box->priv->display_widget != display_widget)
- gtk_container_remove (GTK_CONTAINER (combo_box),
- combo_box->priv->display_widget);
-
- combo_box->priv->display_widget = display_widget;
-
- gtk_box_pack_start (GTK_BOX (combo_box), display_widget, TRUE, TRUE, 0);
-}
-
-static gboolean
-cb_tearable_enter_leave (GtkWidget *w, GdkEventCrossing *event, gpointer data)
-{
- gboolean const flag = GPOINTER_TO_INT(data);
- gtk_widget_set_state (w, flag ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
- return FALSE;
-}
-
-/**
- * gtk_combo_popup_tear_off
- * @combo: Combo box
- * @set_position: Set to position of popup shell if true
- *
- * Tear off the popup
- *
- * FIXME:
- * Gtk popup menus are toplevel windows, not dialogs. I think this is wrong,
- * and make the popups dialogs. But may be there should be a way to make
- * them toplevel. We can do this after creating:
- * GTK_WINDOW (tearoff)->type = GTK_WINDOW_TOPLEVEL;
- */
-static void
-gtk_combo_popup_tear_off (GtkComboBox *combo, gboolean set_position)
-{
- int x, y;
-
- if (!combo->priv->tearoff_window) {
- GtkWidget *tearoff;
- gchar *title;
-
- /* FIXME: made this a toplevel, not a dialog ! */
- tearoff = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_widget_ref (tearoff);
- gtk_object_sink (GTK_OBJECT (tearoff));
- combo->priv->tearoff_window = tearoff;
- gtk_widget_set_app_paintable (tearoff, TRUE);
- g_signal_connect (tearoff, "key_press_event",
- G_CALLBACK (gtk_combo_box_key_press),
- combo);
- gtk_widget_realize (tearoff);
- title = g_object_get_data (G_OBJECT (combo),
- "gtk-combo-title");
- if (title)
- gdk_window_set_title (tearoff->window, title);
- gtk_window_set_policy (GTK_WINDOW (tearoff),
- FALSE, TRUE, FALSE);
- gtk_window_set_transient_for
- (GTK_WINDOW (tearoff),
- GTK_WINDOW (gtk_widget_get_toplevel
- GTK_WIDGET (combo)));
- }
-
- if (GTK_WIDGET_VISIBLE (combo->priv->popup)) {
- gtk_widget_hide (combo->priv->toplevel);
-
- gtk_grab_remove (combo->priv->toplevel);
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- }
-
- gtk_combo_popup_reparent (combo->priv->popup,
- combo->priv->tearoff_window, FALSE);
-
- /* It may have got confused about size */
- gtk_widget_queue_resize (GTK_WIDGET (combo->priv->popup));
-
- if (set_position) {
- gtk_combo_box_get_pos (combo, &x, &y);
- gtk_widget_set_uposition (combo->priv->tearoff_window, x, y);
- }
- gtk_widget_show (GTK_WIDGET (combo->priv->popup));
- gtk_widget_show (combo->priv->tearoff_window);
-
-}
-
-/**
- * gtk_combo_set_tearoff_state
- * @combo_box: Combo box
- * @torn_off: TRUE: Tear off. FALSE: Pop down and reattach
- *
- * Set the tearoff state of the popup
- *
- * Compare with gtk_menu_set_tearoff_state in gtk/gtkmenu.c
- */
-static void
-gtk_combo_set_tearoff_state (GtkComboBox *combo,
- gboolean torn_off)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo));
-
- if (combo->priv->torn_off != torn_off) {
- combo->priv->torn_off = torn_off;
-
- if (combo->priv->torn_off) {
- gtk_combo_popup_tear_off (combo, TRUE);
- deactivate_arrow (combo);
- } else {
- gtk_widget_hide (combo->priv->tearoff_window);
- gtk_combo_popup_reparent (combo->priv->popup,
- combo->priv->toplevel,
- FALSE);
- }
- }
-}
-
-/**
- * gtk_combo_tearoff_bg_copy
- * @combo_box: Combo box
- *
- * Copy popup window image to the tearoff window.
- */
-static void
-gtk_combo_tearoff_bg_copy (GtkComboBox *combo)
-{
- GdkPixmap *pixmap;
- GdkGC *gc;
- GdkGCValues gc_values;
-
- GtkWidget *widget = combo->priv->popup;
-
- if (combo->priv->torn_off) {
- gc_values.subwindow_mode = GDK_INCLUDE_INFERIORS;
- gc = gdk_gc_new_with_values (widget->window,
- &gc_values, GDK_GC_SUBWINDOW);
-
- pixmap = gdk_pixmap_new (widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1);
-
- gdk_draw_pixmap (pixmap, gc,
- widget->window,
- 0, 0, 0, 0, -1, -1);
- gdk_gc_unref (gc);
-
- gtk_widget_set_usize (combo->priv->tearoff_window,
- widget->allocation.width,
- widget->allocation.height);
-
- gdk_window_set_back_pixmap
- (combo->priv->tearoff_window->window, pixmap, FALSE);
- gdk_pixmap_unref (pixmap);
- }
-}
-
-/**
- * gtk_combo_popup_reparent
- * @popup: Popup
- * @new_parent: New parent
- * @unrealize: Unrealize popup if TRUE.
- *
- * Reparent the popup, taking care of the refcounting
- *
- * Compare with gtk_menu_reparent in gtk/gtkmenu.c
- */
-static void
-gtk_combo_popup_reparent (GtkWidget *popup,
- GtkWidget *new_parent,
- gboolean unrealize)
-{
- GtkObject *object = GTK_OBJECT (popup);
- gboolean was_floating = GTK_OBJECT_FLOATING (object);
-
- g_object_ref (object);
- gtk_object_sink (object);
-
- if (unrealize) {
- g_object_ref (object);
- gtk_container_remove (GTK_CONTAINER (popup->parent), popup);
- gtk_container_add (GTK_CONTAINER (new_parent), popup);
- g_object_unref (object);
- }
- else
- gtk_widget_reparent (GTK_WIDGET (popup), new_parent);
- gtk_widget_set_usize (new_parent, -1, -1);
-
- if (was_floating)
- GTK_OBJECT_SET_FLAGS (object, GTK_FLOATING);
- else
- g_object_unref (object);
-}
-
-/**
- * cb_tearable_button_release
- * @w: Widget
- * @event: Event
- * @combo: Combo box
- *
- * Toggle tearoff state.
- */
-static gboolean
-cb_tearable_button_release (GtkWidget *w, GdkEventButton *event,
- GtkComboBox *combo)
-{
- GtkTearoffMenuItem *tearable;
-
- g_return_val_if_fail (w != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_TEAROFF_MENU_ITEM (w), FALSE);
-
- tearable = GTK_TEAROFF_MENU_ITEM (w);
- tearable->torn_off = !tearable->torn_off;
-
- if (!combo->priv->torn_off) {
- gboolean need_connect;
-
- need_connect = (!combo->priv->tearoff_window);
- gtk_combo_set_tearoff_state (combo, TRUE);
- if (need_connect)
- g_signal_connect (combo->priv->tearoff_window,
- "delete_event",
- G_CALLBACK (cb_popup_delete),
- combo);
- } else
- gtk_combo_box_popup_hide_unconditional (combo);
-
- return TRUE;
-}
-
-static gboolean
-cb_popup_delete (GtkWidget *w, GdkEventAny *event, GtkComboBox *combo)
-{
- gtk_combo_box_popup_hide_unconditional (combo);
- return TRUE;
-}
-
-void
-gtk_combo_box_construct (GtkComboBox *combo_box, GtkWidget *display_widget, GtkWidget *pop_down_widget)
-{
- GtkWidget *tearable;
- GtkWidget *vbox;
-
- g_return_if_fail (combo_box != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
- g_return_if_fail (display_widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (display_widget));
-
- GTK_BOX (combo_box)->spacing = 0;
- GTK_BOX (combo_box)->homogeneous = FALSE;
-
- combo_box->priv->pop_down_widget = pop_down_widget;
- combo_box->priv->display_widget = NULL;
-
- vbox = gtk_vbox_new (FALSE, 5);
- tearable = gtk_tearoff_menu_item_new ();
- g_signal_connect (tearable, "enter-notify-event",
- G_CALLBACK (cb_tearable_enter_leave),
- GINT_TO_POINTER (TRUE));
- g_signal_connect (tearable, "leave-notify-event",
- G_CALLBACK (cb_tearable_enter_leave),
- GINT_TO_POINTER (FALSE));
- g_signal_connect (tearable, "button-release-event",
- G_CALLBACK (cb_tearable_button_release),
- (gpointer) combo_box);
- gtk_box_pack_start (GTK_BOX (vbox), tearable, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), pop_down_widget, TRUE, TRUE, 0);
- combo_box->priv->tearable = tearable;
-
- /*
- * Finish setup
- */
- gtk_combo_box_set_display (combo_box, display_widget);
-
- gtk_container_add (GTK_CONTAINER (combo_box->priv->frame), vbox);
- gtk_widget_show_all (combo_box->priv->frame);
-}
-
-GtkWidget *
-gtk_combo_box_new (GtkWidget *display_widget, GtkWidget *optional_popdown)
-{
- GtkComboBox *combo_box;
-
- g_return_val_if_fail (display_widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (display_widget), NULL);
-
- combo_box = g_object_new (GTK_COMBO_BOX_TYPE, NULL);
- gtk_combo_box_construct (combo_box, display_widget, optional_popdown);
- return GTK_WIDGET (combo_box);
-}
-
-void
-gtk_combo_box_set_arrow_relief (GtkComboBox *cc, GtkReliefStyle relief)
-{
- g_return_if_fail (cc != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (cc));
-
- gtk_button_set_relief (GTK_BUTTON (cc->priv->arrow_button), relief);
-}
-
-/**
- * gtk_combo_box_set_title
- * @combo: Combo box
- * @title: Title
- *
- * Set a title to display over the tearoff window.
- *
- * FIXME:
- *
- * This should really change the title even when the popup is already torn off.
- * I guess the tearoff window could attach a listener to title change or
- * something. But I don't think we need the functionality, so I didn't bother
- * to investigate.
- */
-void
-gtk_combo_box_set_title (GtkComboBox *combo,
- const gchar *title)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo));
-
- g_object_set_data_full (G_OBJECT (combo), "gtk-combo-title",
- g_strdup (title), (GDestroyNotify) g_free);
-}
-
-/**
- * gtk_combo_box_set_arrow_sensitive
- * @combo: Combo box
- * @sensitive: Sensitivity value
- *
- * Toggle the sensitivity of the arrow button
- */
-
-void
-gtk_combo_box_set_arrow_sensitive (GtkComboBox *combo,
- gboolean sensitive)
-{
- g_return_if_fail (combo != NULL);
-
- gtk_widget_set_sensitive (combo->priv->arrow_button, sensitive);
-}
-
-/**
- * gtk_combo_box_set_tearable:
- * @combo: Combo box
- * @tearable: whether to allow the @combo to be tearable
- *
- * controls whether the combo box's pop up widget can be torn off.
- */
-void
-gtk_combo_box_set_tearable (GtkComboBox *combo, gboolean tearable)
-{
- g_return_if_fail (combo != NULL);
- g_return_if_fail (GTK_IS_COMBO_BOX (combo));
-
- if (tearable){
- gtk_widget_show (combo->priv->tearable);
- } else {
- gtk_combo_set_tearoff_state (combo, FALSE);
- gtk_widget_hide (combo->priv->tearable);
- }
-}
Index: gal/widgets/gtk-combo-box.h
===================================================================
RCS file: gal/widgets/gtk-combo-box.h
diff -N gal/widgets/gtk-combo-box.h
--- gal/widgets/gtk-combo-box.h 16 Nov 2002 23:42:18 -0000 1.10
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-box.h - a customizable combobox
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel ximian com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _GTK_COMBO_BOX_H_
-#define _GTK_COMBO_BOX_H_
-
-#include <gtk/gtkhbox.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_COMBO_BOX_TYPE (gtk_combo_box_get_type())
-#define GTK_COMBO_BOX(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_combo_box_get_type (), GtkComboBox)
-#define GTK_COMBO_BOX_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_combo_box_get_type (), GtkComboBoxClass)
-#define GTK_IS_COMBO_BOX(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_combo_box_get_type ())
-
-typedef struct _GtkComboBox GtkComboBox;
-typedef struct _GtkComboBoxPrivate GtkComboBoxPrivate;
-typedef struct _GtkComboBoxClass GtkComboBoxClass;
-
-struct _GtkComboBox {
- GtkHBox hbox;
- GtkComboBoxPrivate *priv;
-};
-
-struct _GtkComboBoxClass {
- GtkHBoxClass parent_class;
-
- GtkWidget *(*pop_down_widget) (GtkComboBox *cbox);
-
- /*
- * invoked when the popup has been hidden, if the signal
- * returns TRUE, it means it should be killed from the
- */
- gboolean *(*pop_down_done) (GtkComboBox *cbox, GtkWidget *);
-
- /*
- * Notification signals.
- */
- void (*pre_pop_down) (GtkComboBox *cbox);
- void (*post_pop_hide) (GtkComboBox *cbox);
-};
-
-GtkType gtk_combo_box_get_type (void);
-void gtk_combo_box_construct (GtkComboBox *combo_box,
- GtkWidget *display_widget,
- GtkWidget *optional_pop_down_widget);
-void gtk_combo_box_get_pos (GtkComboBox *combo_box, int *x, int *y);
-
-GtkWidget *gtk_combo_box_new (GtkWidget *display_widget,
- GtkWidget *optional_pop_down_widget);
-void gtk_combo_box_popup_hide (GtkComboBox *combo_box);
-
-void gtk_combo_box_set_display (GtkComboBox *combo_box,
- GtkWidget *display_widget);
-
-void gtk_combo_box_set_title (GtkComboBox *combo,
- const gchar *title);
-
-void gtk_combo_box_set_tearable (GtkComboBox *combo,
- gboolean tearable);
-void gtk_combo_box_set_arrow_sensitive (GtkComboBox *combo,
- gboolean sensitive);
-void gtk_combo_box_set_arrow_relief (GtkComboBox *cc,
- GtkReliefStyle relief);
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif /* _GTK_COMBO_BOX_H_ */
Index: gal/widgets/gtk-combo-stack.c
===================================================================
RCS file: gal/widgets/gtk-combo-stack.c
diff -N gal/widgets/gtk-combo-stack.c
--- gal/widgets/gtk-combo-stack.c 27 Apr 2003 05:56:48 -0000 1.18
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,294 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-stack.c - A combo box for displaying stacks (useful for Undo lists)
- *
- * Copyright (C) 2000 �DI Gerg�actus cactus rulez org>
- *
- * Authors:
- * �DI Gerg�actus cactus rulez org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gtk/gtk.h>
-#include "gtk-combo-stack.h"
-#include "gal/util/e-util.h"
-
-#include <stdio.h>
-
-#define PARENT_TYPE GTK_COMBO_BOX_TYPE
-static GtkObjectClass *gtk_combo_stack_parent_class;
-
-struct _GtkComboStackPrivate {
- GtkWidget *button;
- GtkWidget *list;
- GtkWidget *scrolled_window;
-
- gint num_items;
- gint curr_item;
-};
-
-enum {
- POP,
- LAST_SIGNAL
-};
-static guint gtk_combo_stack_signals [LAST_SIGNAL] = { 0, };
-
-static void
-gtk_combo_stack_destroy (GtkObject *object)
-{
- GtkComboStack *combo = GTK_COMBO_STACK (object);
-
- g_free (combo->priv);
- combo->priv = NULL;
-
- GTK_OBJECT_CLASS (gtk_combo_stack_parent_class)->destroy (object);
-}
-
-
-static void
-gtk_combo_stack_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = gtk_combo_stack_destroy;
-
- gtk_combo_stack_parent_class = g_type_class_ref (PARENT_TYPE);
-
- gtk_combo_stack_signals [POP] = gtk_signal_new (
- "pop",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkComboBoxClass, pop_down_done),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gtk_combo_stack_signals, LAST_SIGNAL);
-}
-
-static void
-gtk_combo_stack_init (GtkComboStack *object)
-{
- object->priv = g_new0 (GtkComboStackPrivate, 1);
- object->priv->num_items = 0;
-}
-
-E_MAKE_TYPE (gtk_combo_stack,
- "GtkComboStack",
- GtkComboStack,
- gtk_combo_stack_class_init,
- gtk_combo_stack_init,
- PARENT_TYPE)
-
-static void
-gtk_combo_stack_clear_selection (GtkComboStack *combo)
-{
- GList *ptr, *items = gtk_container_children (GTK_CONTAINER (combo->priv->list));
- for (ptr = items; ptr; ptr = ptr->next)
- gtk_widget_set_state (GTK_WIDGET (ptr->data), GTK_STATE_NORMAL);
- g_list_free (items);
-}
-
-static void
-button_cb (GtkWidget *button, gpointer data)
-{
- gtk_combo_stack_pop (GTK_COMBO_STACK (data), 1);
-}
-
-static gboolean
-cb_button_release_event (GtkList *list, GdkEventButton *e, gpointer data)
-{
- GtkComboStack *combo = GTK_COMBO_STACK (data);
-
- gtk_combo_stack_clear_selection (combo);
- gtk_combo_box_popup_hide (GTK_COMBO_BOX (combo));
-
- if (combo->priv->curr_item > 0) {
- gint dummy, w, h;
- gdk_window_get_geometry (e->window, &dummy, &dummy, &w, &h, &dummy);
- if (0 <= e->x && e->x < w && 0 <= e->y && e->y < h)
- gtk_combo_stack_pop (combo, combo->priv->curr_item);
- }
- gtk_list_end_drag_selection (list);
-
- return TRUE;
-}
-
-static void
-list_select_cb (GtkList *list, GtkWidget *child, gpointer data)
-{
- GtkComboStack *combo = GTK_COMBO_STACK (data);
- GList *ptr, *items = gtk_container_children (GTK_CONTAINER (list));
- guint i = 0;
-
- gtk_combo_stack_clear_selection (combo);
-
- for (ptr = items; ptr != NULL ; i++ ) {
- gtk_widget_set_state (GTK_WIDGET (ptr->data),
- GTK_STATE_SELECTED);
- ptr = (ptr->data != child) ? ptr->next : NULL;
- }
- g_list_free (items);
-
- combo->priv->curr_item = i;
-}
-
-static void
-gtk_combo_stack_construct (GtkComboStack *combo,
- const gchar *stock_name,
- gboolean const is_scrolled)
-{
- GtkWidget *button, *list, *scroll, *display_widget, *pixmap;
-
- button = combo->priv->button = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
-
- list = combo->priv->list = gtk_list_new ();
-
- /* Create the button */
- pixmap = gtk_image_new_from_stock (
- stock_name, GTK_ICON_SIZE_LARGE_TOOLBAR);
- gtk_widget_show (pixmap);
- gtk_container_add (GTK_CONTAINER (button), pixmap);
- gtk_widget_set_usize (GTK_WIDGET (pixmap), 24, 22);
-
- if (is_scrolled) {
- display_widget = scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (
- GTK_SCROLLED_WINDOW(scroll), list);
- gtk_container_set_focus_hadjustment (
- GTK_CONTAINER (list),
- gtk_scrolled_window_get_hadjustment (
- GTK_SCROLLED_WINDOW (scroll)));
- gtk_container_set_focus_vadjustment (
- GTK_CONTAINER (list),
- gtk_scrolled_window_get_vadjustment (
- GTK_SCROLLED_WINDOW (scroll)));
- gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
- } else
- display_widget = list;
-
- /* Set up the dropdown list */
- gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
- g_signal_connect (list, "select-child",
- G_CALLBACK (list_select_cb),
- (gpointer) combo);
- g_signal_connect (list, "button_release_event",
- G_CALLBACK (cb_button_release_event),
- (gpointer) combo);
-
- g_signal_connect (button, "clicked",
- G_CALLBACK (button_cb),
- (gpointer) combo);
-
- gtk_widget_show (display_widget);
- gtk_widget_show (button);
- gtk_combo_box_construct (GTK_COMBO_BOX (combo), button, display_widget);
- gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
-}
-
-GtkWidget*
-gtk_combo_stack_new (const gchar *stock,
- gboolean const is_scrolled)
-{
- GtkComboStack *combo;
-
- combo = g_object_new (GTK_COMBO_STACK_TYPE, NULL);
- gtk_combo_stack_construct (combo, stock, is_scrolled);
-
- return GTK_WIDGET (combo);
-}
-
-void
-gtk_combo_stack_push_item (GtkComboStack *combo,
- const gchar *item)
-{
- GtkWidget *listitem;
-
- g_return_if_fail (item != NULL);
-
- combo->priv->num_items++;
-
- listitem = gtk_list_item_new_with_label (item);
- gtk_widget_show (listitem);
-
- gtk_list_prepend_items (GTK_LIST (combo->priv->list),
- g_list_prepend (NULL, listitem));
-/* gtk_list_unselect_all (GTK_LIST (combo->priv->list)); */
- gtk_combo_stack_clear_selection (combo);
-
- gtk_widget_set_sensitive (GTK_WIDGET (combo), TRUE);
-}
-
-void
-gtk_combo_stack_pop (GtkComboStack *combo, gint num)
-{
- g_signal_emit_by_name (combo, "pop", num);
-}
-
-void
-gtk_combo_stack_remove_top (GtkComboStack *combo, gint num)
-{
- gint i;
- GList *child, *children;
- GtkWidget *list = combo->priv->list;
-
- g_return_if_fail (combo->priv->num_items != 0);
-
- if (num > combo->priv->num_items)
- num = combo->priv->num_items;
-
- children = child = gtk_container_children (GTK_CONTAINER (list));
- for (i = 0; i < num; i++) {
- gtk_container_remove (GTK_CONTAINER (list), child->data);
- child = g_list_next (child);
- }
- g_list_free (children);
-
- gtk_combo_stack_clear_selection (combo);
-
- combo->priv->num_items -= num;
- combo->priv->curr_item = -1;
- if (!combo->priv->num_items)
- gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
-}
-
-void
-gtk_combo_stack_clear (GtkComboStack *combo)
-{
- combo->priv->num_items = 0;
- gtk_list_clear_items (GTK_LIST (combo->priv->list), 0, -1);
- gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
-}
-
-/*
- * Make sure stack is not deeper than @n elements.
- *
- * (Think undo/redo where we don't want to use too much memory.)
- */
-void
-gtk_combo_stack_truncate (GtkComboStack *combo, int n)
-{
- if (combo->priv->num_items > n) {
- combo->priv->num_items = n;
-
- gtk_list_clear_items (GTK_LIST (combo->priv->list), n, -1);
- if (n == 0)
- gtk_widget_set_sensitive (GTK_WIDGET (combo), FALSE);
- }
-}
Index: gal/widgets/gtk-combo-stack.h
===================================================================
RCS file: gal/widgets/gtk-combo-stack.h
diff -N gal/widgets/gtk-combo-stack.h
--- gal/widgets/gtk-combo-stack.h 16 Nov 2002 23:42:18 -0000 1.13
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-stack.h - A combo box for displaying stacks (useful for Undo lists)
- *
- * Copyright (C) 2000 �DI Gerg�actus cactus rulez org>
- *
- * Authors:
- * �DI Gerg�actus cactus rulez org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _GTK_COMBO_STACK_H
-#define _GTK_COMBO_STACK_H
-
-#include <gtk/gtkwidget.h>
-#include "gtk-combo-box.h"
-
-G_BEGIN_DECLS
-
-#define GTK_COMBO_STACK_TYPE (gtk_combo_stack_get_type ())
-#define GTK_COMBO_STACK(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_combo_stack_get_type (), GtkComboStack)
-#define GTK_COMBO_STACK_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_combo_stack_get_type (), GtkComboTextClass)
-#define GTK_IS_COMBO_STACK(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_combo_stack_get_type ())
-
-typedef struct _GtkComboStack GtkComboStack;
-typedef struct _GtkComboStackPrivate GtkComboStackPrivate;
-typedef struct _GtkComboStackClass GtkComboStackClass;
-
-struct _GtkComboStack {
- GtkComboBox parent;
-
- GtkComboStackPrivate *priv;
-};
-
-struct _GtkComboStackClass {
- GtkComboBoxClass parent_class;
-};
-
-
-GtkType gtk_combo_stack_get_type (void);
-GtkWidget *gtk_combo_stack_new (const gchar *stock_name,
- gboolean const is_scrolled);
-
-void gtk_combo_stack_push_item (GtkComboStack *combo_stack,
- const gchar *item);
-
-void gtk_combo_stack_remove_top (GtkComboStack *combo_stack,
- gint num);
-void gtk_combo_stack_pop (GtkComboStack *combo_stack,
- gint num);
-void gtk_combo_stack_clear (GtkComboStack *combo_stack);
-void gtk_combo_stack_truncate (GtkComboStack *combo, int n);
-
-G_END_DECLS
-
-#endif
Index: gal/widgets/gtk-combo-text.c
===================================================================
RCS file: gal/widgets/gtk-combo-text.c
diff -N gal/widgets/gtk-combo-text.c
--- gal/widgets/gtk-combo-text.c 16 Nov 2002 23:42:18 -0000 1.27
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,433 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-text.c - A combo box for selecting from a list.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <ctype.h>
-#include <gal/util/e-util.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklist.h>
-#include <gtk/gtkscrolledwindow.h>
-#include "gtk-combo-text.h"
-
-#define PARENT_TYPE GTK_COMBO_BOX_TYPE
-static GtkObjectClass *gtk_combo_text_parent_class;
-
-static gboolean cb_pop_down (GtkWidget *w, GtkWidget *pop_down,
- gpointer dummy);
-
-static void list_unselect_cb (GtkWidget *list, GtkWidget *child,
- gpointer data);
-
-static void update_list_selection (GtkComboText *ct, const gchar *text);
-
-static void
-gtk_combo_text_destroy (GtkObject *object)
-{
- GtkComboText *ct = GTK_COMBO_TEXT (object);
-
- if (ct->elements != NULL) {
- g_hash_table_destroy (ct->elements);
- ct->elements = NULL;
- }
- if (ct->list != NULL) {
- g_signal_handlers_disconnect_matched (ct,
- G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL,
- cb_pop_down, NULL);
-
- g_signal_handlers_disconnect_matched (ct->list,
- G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- list_unselect_cb, ct);
- ct->list = NULL;
- }
-
- (*gtk_combo_text_parent_class->destroy) (object);
-}
-
-static void
-gtk_combo_text_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = >k_combo_text_destroy;
- gtk_combo_text_parent_class = g_type_class_ref (PARENT_TYPE);
-}
-
-static void
-gtk_combo_text_init (GtkComboText *object)
-{
-}
-
-E_MAKE_TYPE (gtk_combo_text,
- "GtkComboText",
- GtkComboText,
- gtk_combo_text_class_init,
- gtk_combo_text_init,
- PARENT_TYPE)
-
-static gint
-strcase_equal (gconstpointer v, gconstpointer v2)
-{
- return g_strcasecmp ((const gchar*) v, (const gchar*)v2) == 0;
-}
-
-
-/*
- * a char* hash function from ASU
- *
- * This is cut/paste from gutils.c
- * We've got to do this, because this widget will soon move out of the
- * Gnumeric source and into a separate library.
- */
-static guint
-strcase_hash (gconstpointer v)
-{
- const unsigned char *s = (const unsigned char *)v;
- const unsigned char *p;
- guint h = 0, g;
-
- for(p = s; *p != '\0'; p += 1) {
- h = ( h << 4 ) + tolower (*p);
- if ( ( g = h & 0xf0000000 ) ) {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h /* % M */;
-}
-
-/**
- * gtk_combo_text_set_case_sensitive
- * @combo_text: ComboText widget
- * @val: make case sensitive if TRUE
- *
- * Specifies whether the text entered into the GtkEntry field and the text
- * in the list items is case sensitive. Because the values are stored in a
- * hash, it is not legal to change case sensitivity when the list contains
- * elements.
- *
- * Returns: The function returns -1 if request could not be honored. On
- * success, it returns 0.
- */
-gint
-gtk_combo_text_set_case_sensitive (GtkComboText *combo, gboolean val)
-{
- if (combo->elements
- && g_hash_table_size (combo->elements) > 0
- && val != combo->case_sensitive)
- return -1;
- else {
- combo->case_sensitive = val;
- if (val != combo->case_sensitive) {
- GHashFunc hashfunc;
- GCompareFunc comparefunc;
-
- g_hash_table_destroy (combo->elements);
- if (combo->case_sensitive) {
- hashfunc = g_str_hash;
- comparefunc = g_str_equal;
- } else {
- hashfunc = strcase_hash;
- comparefunc = strcase_equal;
- }
- combo->elements = g_hash_table_new (hashfunc,
- comparefunc);
- }
- return 0;
- }
-}
-
-static void
-entry_activate_cb (GtkWidget *entry, gpointer data)
-{
- GtkComboText *combo = GTK_COMBO_TEXT (data);
-
- update_list_selection (combo,
- gtk_entry_get_text (GTK_ENTRY (combo->entry)));
-}
-
-
-static void
-list_select_cb (GtkWidget *list, GtkWidget *child, gpointer data)
-{
- GtkComboText *combo = GTK_COMBO_TEXT (data);
- GtkEntry *entry = GTK_ENTRY (combo->entry);
- gchar *value = (gchar*) g_object_get_data (G_OBJECT (child), "value");
-
- g_return_if_fail (entry && value);
-
- if (combo->cached_entry == child)
- combo->cached_entry = NULL;
-
- gtk_entry_set_text (entry, value);
- gtk_signal_handler_block_by_func (GTK_OBJECT (entry),
- GTK_SIGNAL_FUNC (entry_activate_cb),
- (gpointer) combo);
- g_signal_emit_by_name (entry, "activate");
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (entry),
- GTK_SIGNAL_FUNC (entry_activate_cb),
- (gpointer) combo);
-
- gtk_combo_box_popup_hide (GTK_COMBO_BOX (data));
-}
-
-static void
-list_unselect_cb (GtkWidget *list, GtkWidget *child, gpointer data)
-{
- if (GTK_WIDGET_VISIBLE (list)) /* Undo interactive unselect */
- gtk_list_select_child (GTK_LIST (list), child);
-}
-
-static void
-cb_toggle (GtkWidget *child, gpointer data)
-{
- GtkComboText *ct = GTK_COMBO_TEXT (data);
-
- gtk_list_select_child (GTK_LIST (ct->list), child);
-}
-
-void
-gtk_combo_text_select_item (GtkComboText *ct, int elem)
-{
- gtk_list_select_item (GTK_LIST(ct->list), elem);
-}
-
-static void
-update_list_selection (GtkComboText *ct, const gchar *text)
-{
- gpointer candidate;
- GtkWidget *child;
-
- gtk_signal_handler_block_by_func (GTK_OBJECT (ct->list),
- GTK_SIGNAL_FUNC (list_select_cb),
- (gpointer) ct);
- gtk_signal_handler_block_by_func (GTK_OBJECT (ct->list),
- GTK_SIGNAL_FUNC (list_unselect_cb),
- (gpointer) ct);
-
- gtk_list_unselect_all (GTK_LIST (ct->list));
- candidate = g_hash_table_lookup (ct->elements, (gconstpointer) text);
- if (candidate && GTK_IS_WIDGET (candidate)) {
- child = GTK_WIDGET (candidate);
- gtk_list_select_child (GTK_LIST (ct->list), child);
- gtk_widget_grab_focus (child);
- }
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (ct->list),
- GTK_SIGNAL_FUNC (list_select_cb),
- (gpointer) ct);
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (ct->list),
- GTK_SIGNAL_FUNC (list_unselect_cb),
- (gpointer) ct);
-}
-
-void
-gtk_combo_text_set_text (GtkComboText *ct, const gchar *text)
-{
- gtk_entry_set_text (GTK_ENTRY (ct->entry), text);
- update_list_selection (ct, text);
-}
-
-/*
- * We can't just cache the old widget state on entry: If the pointer is
- * dragged, we receive two enter-notify-events, and the original cached
- * value would be overwritten with the GTK_STATE_ACTIVE we just set.
- *
- * However, we know that the gtklist only uses GTK_STATE_SELECTED and
- * GTK_STATE_NORMAL. We're OK if we only cache those two.
- */
-static gboolean
-cb_enter (GtkWidget *w, GdkEventCrossing *event,
- gpointer user)
-{
- GtkComboText *ct = user;
- GtkStateType state = GTK_WIDGET_STATE (w);
-
- if (state == GTK_STATE_NORMAL || state == GTK_STATE_SELECTED) {
- ct->cached_entry = w;
- ct->cache_mouse_state = state;
- }
- if (state != GTK_STATE_SELECTED)
- gtk_widget_set_state (w, GTK_STATE_ACTIVE);
-
- return TRUE;
-}
-static gboolean
-cb_exit (GtkWidget *w, GdkEventCrossing *event,
- gpointer user)
-{
- GtkComboText *ct = user;
-
- if (ct->cached_entry == w)
- gtk_widget_set_state (w, ct->cache_mouse_state);
-
- return TRUE;
-}
-
-static gboolean
-cb_pop_down (GtkWidget *w, GtkWidget *pop_down, gpointer dummy)
-{
- GtkComboText *ct = GTK_COMBO_TEXT (w);
-
- if (ct->cached_entry)
- gtk_widget_set_state (ct->cached_entry, ct->cache_mouse_state);
- ct->cached_entry = NULL;
-
- return FALSE;
-}
-
-typedef struct {
- GtkComboText *ct;
- gchar *value;
-} WeakRefClosure;
-
-static void
-cb_remove_from_hash (gpointer data, GObject *where_object_was)
-{
- WeakRefClosure *closure = data;
-
- if (closure->ct->elements)
- g_hash_table_remove (closure->ct->elements, closure->value);
-
- g_free (closure->value);
- g_free (closure);
-}
-
-void
-gtk_combo_text_add_item (GtkComboText *ct,
- const gchar *item,
- const gchar *value)
-{
- WeakRefClosure *weak_ref_closure;
- GtkWidget *listitem;
- gchar *value_copy;
-
- g_return_if_fail (item);
-
- if (!value)
- value = item;
-
- value_copy = g_strdup (value);
-
- listitem = gtk_list_item_new_with_label (item);
- gtk_widget_show (listitem);
-
- g_object_set_data_full (G_OBJECT (listitem), "value",
- value_copy, g_free);
- g_signal_connect (listitem, "enter-notify-event",
- G_CALLBACK (cb_enter),
- (gpointer) ct);
- g_signal_connect (listitem, "leave-notify-event",
- G_CALLBACK (cb_exit),
- (gpointer) ct);
- g_signal_connect (listitem, "toggle",
- G_CALLBACK (cb_toggle),
- (gpointer) ct);
-
- gtk_container_add (GTK_CONTAINER (ct->list),
- listitem);
-
- g_hash_table_insert (ct->elements, (gpointer)value_copy,
- (gpointer) listitem);
-
- weak_ref_closure = g_new (WeakRefClosure, 1);
- weak_ref_closure->ct = ct;
- weak_ref_closure->value = g_strdup (value_copy);
-
- g_object_weak_ref (G_OBJECT (listitem),
- cb_remove_from_hash,
- weak_ref_closure);
-}
-
-static void
-cb_list_mapped (GtkWidget *widget, gpointer user_data)
-{
- GtkList *list = GTK_LIST (widget);
-
- if (g_list_length (list->selection) > 0)
- gtk_widget_grab_focus (GTK_WIDGET ((list->selection->data)));
-}
-
-void
-gtk_combo_text_construct (GtkComboText *ct, gboolean const is_scrolled)
-{
- GtkWidget *entry, *list, *scroll, *display_widget;
-
- ct->case_sensitive = FALSE;
- ct->elements = g_hash_table_new (&strcase_hash,
- &strcase_equal);
-
- /* Probably irrelevant, but lets be careful */
- ct->cache_mouse_state = GTK_STATE_NORMAL;
- ct->cached_entry = NULL;
-
- entry = ct->entry = gtk_entry_new ();
- list = ct->list = gtk_list_new ();
- if (is_scrolled) {
- display_widget = scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll),
- GTK_POLICY_NEVER,
- GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (
- GTK_SCROLLED_WINDOW(scroll), list);
- gtk_container_set_focus_hadjustment (
- GTK_CONTAINER (list),
- gtk_scrolled_window_get_hadjustment (
- GTK_SCROLLED_WINDOW (scroll)));
- gtk_container_set_focus_vadjustment (
- GTK_CONTAINER (list),
- gtk_scrolled_window_get_vadjustment (
- GTK_SCROLLED_WINDOW (scroll)));
- gtk_widget_set_usize (scroll, 0, 200); /* MAGIC NUMBER */
- } else
- display_widget = list;
-
- g_signal_connect (entry, "activate",
- G_CALLBACK (entry_activate_cb),
- ct);
- g_signal_connect (list, "select-child",
- G_CALLBACK (list_select_cb),
- ct);
- g_signal_connect (list, "unselect-child",
- G_CALLBACK (list_unselect_cb),
- ct);
- g_signal_connect (list, "map",
- G_CALLBACK (cb_list_mapped), NULL);
-
- gtk_widget_show (display_widget);
- gtk_widget_show (entry);
- gtk_combo_box_construct (GTK_COMBO_BOX (ct), entry, display_widget);
- g_signal_connect (ct, "pop_down_done",
- G_CALLBACK (cb_pop_down), NULL);
-}
-
-GtkWidget*
-gtk_combo_text_new (gboolean const is_scrolled)
-{
- GtkComboText *ct;
-
- ct = g_object_new (GTK_COMBO_TEXT_TYPE, NULL);
- gtk_combo_text_construct (ct, is_scrolled);
- return GTK_WIDGET (ct);
-}
-
Index: gal/widgets/gtk-combo-text.h
===================================================================
RCS file: gal/widgets/gtk-combo-text.h
diff -N gal/widgets/gtk-combo-text.h
--- gal/widgets/gtk-combo-text.h 16 Nov 2002 23:42:18 -0000 1.13
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gtk-combo-text.h - A combo box for selecting from a list.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _GTK_COMBO_TEXT_H
-#define _GTK_COMBO_TEXT_H
-
-#include <gal/widgets/gtk-combo-box.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GTK_COMBO_TEXT_TYPE (gtk_combo_text_get_type ())
-#define GTK_COMBO_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, gtk_combo_text_get_type (), GtkComboText)
-#define GTK_COMBO_TEXT_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, gtk_combo_text_get_type (), GtkComboTextClass)
-#define GTK_IS_COMBO_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, gtk_combo_text_get_type ())
-
-typedef struct _GtkComboText GtkComboText;
-/* typedef struct _GtkComboTextPrivate GtkComboTextPrivate;*/
-typedef struct _GtkComboTextClass GtkComboTextClass;
-
-struct _GtkComboText {
- GtkComboBox parent;
-
- GtkWidget *entry;
- GtkWidget *list;
- GtkWidget *scrolled_window;
- GtkStateType cache_mouse_state;
- GtkWidget *cached_entry;
- gboolean case_sensitive;
- GHashTable*elements;
-};
-
-struct _GtkComboTextClass {
- GtkComboBoxClass parent_class;
-};
-
-
-GtkType gtk_combo_text_get_type (void);
-GtkWidget *gtk_combo_text_new (gboolean const is_scrolled);
-void gtk_combo_text_construct (GtkComboText *ct, gboolean const is_scrolled);
-
-gint gtk_combo_text_set_case_sensitive (GtkComboText *combo_text,
- gboolean val);
-void gtk_combo_text_select_item (GtkComboText *combo_text,
- int elem);
-void gtk_combo_text_set_text (GtkComboText *combo_text,
- const gchar *text);
-void gtk_combo_text_add_item (GtkComboText *combo_text,
- const gchar *item,
- const gchar *value);
-
-#ifdef __cplusplus
-};
-#endif /* __cplusplus */
-
-#endif
Index: gal/widgets/widget-color-combo.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/widget-color-combo.c,v
retrieving revision 1.45
diff -u -r1.45 widget-color-combo.c
--- gal/widgets/widget-color-combo.c 30 May 2003 16:10:54 -0000 1.45
+++ gal/widgets/widget-color-combo.c 16 Feb 2004 16:59:25 -0000
@@ -47,7 +47,7 @@
static guint color_combo_signals [LAST_SIGNAL] = { 0, };
-#define PARENT_TYPE GTK_COMBO_BOX_TYPE
+#define PARENT_TYPE GAL_COMBO_BOX_TYPE
static GObjectClass *color_combo_parent_class;
#define make_color(CC,COL) (((COL) != NULL) ? (COL) : ((CC) ? ((CC)->default_color) : NULL))
@@ -101,7 +101,7 @@
g_signal_emit (cc,
color_combo_signals [CHANGED], 0,
color, is_custom, by_user, is_default);
- gtk_combo_box_popup_hide (GTK_COMBO_BOX (cc));
+ gal_combo_box_popup_hide (GAL_COMBO_BOX (cc));
}
static void
@@ -126,7 +126,7 @@
static void
cb_cust_color_clicked (GtkWidget *widget, ColorCombo *cc)
{
- gtk_combo_box_popup_hide (GTK_COMBO_BOX (cc));
+ gal_combo_box_popup_hide (GAL_COMBO_BOX (cc));
}
/*
@@ -230,7 +230,7 @@
gtk_widget_show_all (cc->preview_button);
- gtk_combo_box_construct (GTK_COMBO_BOX (cc),
+ gal_combo_box_construct (GAL_COMBO_BOX (cc),
cc->preview_button,
GTK_WIDGET (cc->palette));
Index: gal/widgets/widget-color-combo.h
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/widget-color-combo.h,v
retrieving revision 1.22
diff -u -r1.22 widget-color-combo.h
--- gal/widgets/widget-color-combo.h 16 Nov 2002 23:42:18 -0000 1.22
+++ gal/widgets/widget-color-combo.h 16 Feb 2004 16:59:25 -0000
@@ -32,13 +32,13 @@
#define GNUMERIC_WIDGET_COLOR_COMBO_H
#include <gtk/gtkwidget.h>
-#include <gal/widgets/gtk-combo-box.h>
+#include <gal/widgets/gal-combo-box.h>
#include <gal/widgets/color-palette.h>
G_BEGIN_DECLS
typedef struct _ColorCombo {
- GtkComboBox combo_box;
+ GalComboBox combo_box;
/*
* Canvas where we display
@@ -53,7 +53,7 @@
} ColorCombo;
typedef struct {
- GtkComboBoxClass parent_class;
+ GalComboBoxClass parent_class;
/* Signals emited by this widget */
void (* color_changed) (ColorCombo *color_combo, GdkColor *color,
Index: gal/widgets/widget-pixmap-combo.c
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/widget-pixmap-combo.c,v
retrieving revision 1.14
diff -u -r1.14 widget-pixmap-combo.c
--- gal/widgets/widget-pixmap-combo.c 16 Nov 2002 23:42:18 -0000 1.14
+++ gal/widgets/widget-pixmap-combo.c 16 Feb 2004 16:59:25 -0000
@@ -26,7 +26,7 @@
#include <gtk/gtksignal.h>
#include <gtk/gtktable.h>
#include <libgnome/gnome-i18n.h>
-#include "gtk-combo-box.h"
+#include "gal-combo-box.h"
#include "widget-pixmap-combo.h"
#include "gal/util/e-util.h"
@@ -40,7 +40,7 @@
static guint pixmap_combo_signals [LAST_SIGNAL] = { 0, };
-#define PARENT_TYPE GTK_COMBO_BOX_TYPE
+#define PARENT_TYPE GAL_COMBO_BOX_TYPE
static GtkObjectClass *pixmap_combo_parent_class;
/***************************************************************************/
@@ -98,7 +98,7 @@
int index = GPOINTER_TO_INT (gtk_object_get_user_data (GTK_OBJECT (button)));
pixmap_combo_select_pixmap (pc, index);
emit_change (button, pc);
- gtk_combo_box_popup_hide (GTK_COMBO_BOX (pc));
+ gal_combo_box_popup_hide (GAL_COMBO_BOX (pc));
}
static GtkWidget *
@@ -180,7 +180,7 @@
gtk_widget_show_all (pc->preview_button);
- gtk_combo_box_construct (GTK_COMBO_BOX (pc),
+ gal_combo_box_construct (GAL_COMBO_BOX (pc),
pc->preview_button,
pc->combo_table);
}
Index: gal/widgets/widget-pixmap-combo.h
===================================================================
RCS file: /cvs/gnome/gal/gal/widgets/widget-pixmap-combo.h,v
retrieving revision 1.9
diff -u -r1.9 widget-pixmap-combo.h
--- gal/widgets/widget-pixmap-combo.h 16 Nov 2002 23:42:18 -0000 1.9
+++ gal/widgets/widget-pixmap-combo.h 16 Feb 2004 16:59:25 -0000
@@ -29,7 +29,7 @@
#include <gtk/gtktooltips.h>
#include <libgnomecanvas/gnome-canvas.h>
#include <libgnomeui/gnome-pixmap.h>
-#include <gal/widgets/gtk-combo-box.h>
+#include <gal/widgets/gal-combo-box.h>
G_BEGIN_DECLS
@@ -45,7 +45,7 @@
} PixmapComboElement;
typedef struct {
- GtkComboBox combo_box;
+ GalComboBox combo_box;
/* Static information */
PixmapComboElement const *elements;
@@ -67,7 +67,7 @@
void pixmap_combo_select_pixmap (PixmapCombo *combo, int index);
typedef struct {
- GtkComboBoxClass parent_class;
+ GalComboBoxClass parent_class;
/* Signals emited by this widget */
void (* changed) (PixmapCombo *pixmap_combo, int index);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]