From: gustav_b Date: Wed, 26 Sep 2007 00:33:51 +0000 (+0000) Subject: Removed libgdl component not used by Inkscape. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=37badff749052ab1ea1c806bbd04a8f4ab123091;p=inkscape.git Removed libgdl component not used by Inkscape. --- diff --git a/src/libgdl/Makefile_insert b/src/libgdl/Makefile_insert index b4a7209e4..3f07931f8 100644 --- a/src/libgdl/Makefile_insert +++ b/src/libgdl/Makefile_insert @@ -16,7 +16,6 @@ libgdl_libgdl_a_SOURCES = \ libgdl/gdl-dock-tablabel.h \ libgdl/gdl-dock-placeholder.h \ libgdl/gdl-dock-bar.h \ - libgdl/gdl-combo-button.h \ libgdl/gdl-stock.h \ libgdl/gdl-stock-icons.h \ libgdl/gdl-i18n.h \ @@ -32,7 +31,6 @@ libgdl_libgdl_a_SOURCES = \ libgdl/gdl-dock-tablabel.c \ libgdl/gdl-dock-placeholder.c \ libgdl/gdl-dock-bar.c \ - libgdl/gdl-combo-button.c \ libgdl/gdl-stock.c \ libgdl/gdl-switcher.h \ libgdl/gdl-switcher.c \ diff --git a/src/libgdl/gdl-combo-button.c b/src/libgdl/gdl-combo-button.c deleted file mode 100644 index 6414a8110..000000000 --- a/src/libgdl/gdl-combo-button.c +++ /dev/null @@ -1,383 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * gdl-combo-button.c - * - * Copyright (C) 2003 Jeroen Zwartepoorte - * - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include "gdl-tools.h" -#include "gdl-combo-button.h" - -struct _GdlComboButtonPrivate { - GtkWidget *default_button; - GtkWidget *image; - GtkWidget *label; - GtkWidget *menu_button; - GtkWidget *menu; - gboolean menu_popped_up; -}; - -GDL_CLASS_BOILERPLATE (GdlComboButton, gdl_combo_button, GtkHBox, GTK_TYPE_HBOX); - -static void -default_button_clicked_cb (GtkButton *button, - gpointer user_data) -{ - GdlComboButton *combo; - GdlComboButtonPrivate *priv; - - combo = GDL_COMBO_BUTTON (user_data); - priv = combo->priv; - - if (!priv->menu_popped_up) - g_signal_emit_by_name (G_OBJECT (combo), - "activate-default", NULL); -} - -static gboolean -default_button_press_event_cb (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - if (event->type == GDK_BUTTON_PRESS && event->button == 1) { - GTK_BUTTON (priv->menu_button)->button_down = TRUE; - gtk_button_pressed (GTK_BUTTON (priv->menu_button)); - } - - return FALSE; -} - -static gboolean -default_button_release_event_cb (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - if (event->button == 1) { - gtk_button_released (GTK_BUTTON (priv->menu_button)); - } - - return FALSE; -} - -static gboolean -button_enter_notify_cb (GtkWidget *widget, - GdkEventCrossing *event, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - if (event->detail != GDK_NOTIFY_INFERIOR) { - GTK_BUTTON (priv->default_button)->in_button = TRUE; - GTK_BUTTON (priv->menu_button)->in_button = TRUE; - gtk_button_enter (GTK_BUTTON (priv->default_button)); - gtk_button_enter (GTK_BUTTON (priv->menu_button)); - } - - return TRUE; -} - -static gboolean -button_leave_notify_cb (GtkWidget *widget, - GdkEventCrossing *event, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - if (priv->menu_popped_up) - return TRUE; - - if (event->detail != GDK_NOTIFY_INFERIOR) { - GTK_BUTTON (priv->default_button)->in_button = FALSE; - GTK_BUTTON (priv->menu_button)->in_button = FALSE; - gtk_button_leave (GTK_BUTTON (priv->default_button)); - gtk_button_leave (GTK_BUTTON (priv->menu_button)); - } - - return TRUE; -} - -static void -menu_position_func (GtkMenu *menu, - gint *x_return, - gint *y_return, - gboolean *push_in, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - GtkAllocation *allocation; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - allocation = &(priv->default_button->allocation); - - gdk_window_get_origin (priv->default_button->window, x_return, y_return); - - *x_return += allocation->x; - *y_return += allocation->height; -} - -static gboolean -menu_button_press_event_cb (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - if (event->type == GDK_BUTTON_PRESS && - (event->button == 1 || event->button == 3)) { - GTK_BUTTON (priv->menu_button)->button_down = TRUE; - - gtk_button_pressed (GTK_BUTTON (priv->menu_button)); - - priv->menu_popped_up = TRUE; - gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL, - menu_position_func, combo_button, - event->button, event->time); - } - - return TRUE; -} - -static void -menu_deactivate_cb (GtkMenuShell *menu_shell, - gpointer user_data) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (user_data); - priv = combo_button->priv; - - priv->menu_popped_up = FALSE; - - GTK_BUTTON (priv->menu_button)->button_down = FALSE; - GTK_BUTTON (priv->menu_button)->in_button = FALSE; - GTK_BUTTON (priv->default_button)->in_button = FALSE; - gtk_button_leave (GTK_BUTTON (priv->menu_button)); - gtk_button_leave (GTK_BUTTON (priv->default_button)); - gtk_button_clicked (GTK_BUTTON (priv->menu_button)); -} - -static void -menu_detacher (GtkWidget *widget, - GtkMenu *menu) -{ - GdlComboButton *combo_button; - - combo_button = GDL_COMBO_BUTTON (widget); - - g_signal_handlers_disconnect_by_func (G_OBJECT (menu), - menu_deactivate_cb, - combo_button); - combo_button->priv->menu = NULL; -} - -static void -gdl_combo_button_destroy (GtkObject *object) -{ - GdlComboButton *combo_button; - GdlComboButtonPrivate *priv; - - combo_button = GDL_COMBO_BUTTON (object); - priv = combo_button->priv; - - if (priv) { - g_free (priv); - combo_button->priv = NULL; - } - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -gdl_combo_button_class_init (GdlComboButtonClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - - parent_class = g_type_class_peek_parent (klass); - object_class = GTK_OBJECT_CLASS (klass); - widget_class = GTK_WIDGET_CLASS (klass); - - object_class->destroy = gdl_combo_button_destroy; - - g_signal_new ("activate-default", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GdlComboButtonClass, activate_default), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); -} - -static void -gdl_combo_button_instance_init (GdlComboButton *combo_button) -{ - GdlComboButtonPrivate *priv; - GtkWidget *hbox, *align, *arrow; - - priv = g_new (GdlComboButtonPrivate, 1); - combo_button->priv = priv; - - priv->menu = NULL; - priv->menu_popped_up = FALSE; - - priv->default_button = gtk_button_new (); - gtk_button_set_relief (GTK_BUTTON (priv->default_button), GTK_RELIEF_NONE); - - /* Following code copied from gtk_button_construct_child. */ - priv->label = gtk_label_new (""); - gtk_label_set_use_underline (GTK_LABEL (priv->label), TRUE); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->label), - priv->default_button); - - priv->image = gtk_image_new (); - hbox = gtk_hbox_new (FALSE, 2); - - align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - - gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbox), priv->label, FALSE, FALSE, 0); - - gtk_container_add (GTK_CONTAINER (priv->default_button), align); - gtk_container_add (GTK_CONTAINER (align), hbox); - /* End copied block. */ - - gtk_box_pack_start (GTK_BOX (combo_button), priv->default_button, - FALSE, FALSE, 0); - gtk_widget_show_all (priv->default_button); - - priv->menu_button = gtk_button_new (); - gtk_button_set_relief (GTK_BUTTON (priv->menu_button), GTK_RELIEF_NONE); - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); - gtk_container_add (GTK_CONTAINER (priv->menu_button), arrow); - gtk_box_pack_start (GTK_BOX (combo_button), priv->menu_button, FALSE, - FALSE, 0); - gtk_widget_show_all (priv->menu_button); - - /* Default button. */ - g_signal_connect (G_OBJECT (priv->default_button), "clicked", - G_CALLBACK (default_button_clicked_cb), combo_button); - g_signal_connect (G_OBJECT (priv->default_button), "button_press_event", - G_CALLBACK (default_button_press_event_cb), combo_button); - g_signal_connect (G_OBJECT (priv->default_button), "button_release_event", - G_CALLBACK (default_button_release_event_cb), combo_button); - g_signal_connect (G_OBJECT (priv->default_button), "enter_notify_event", - G_CALLBACK (button_enter_notify_cb), combo_button); - g_signal_connect (G_OBJECT (priv->default_button), "leave_notify_event", - G_CALLBACK (button_leave_notify_cb), combo_button); - - /* Menu button. */ - g_signal_connect (G_OBJECT (priv->menu_button), "button_press_event", - G_CALLBACK (menu_button_press_event_cb), combo_button); - g_signal_connect (G_OBJECT (priv->menu_button), "enter_notify_event", - G_CALLBACK (button_enter_notify_cb), combo_button); - g_signal_connect (G_OBJECT (priv->menu_button), "leave_notify_event", - G_CALLBACK (button_leave_notify_cb), combo_button); -} - -GtkWidget * -gdl_combo_button_new (void) -{ - GtkWidget *combo_button; - - combo_button = GTK_WIDGET (g_object_new (GDL_TYPE_COMBO_BUTTON, NULL)); - - return combo_button; -} - -void -gdl_combo_button_set_icon (GdlComboButton *combo_button, - GdkPixbuf *pixbuf) -{ - GdlComboButtonPrivate *priv; - - g_return_if_fail (GDL_IS_COMBO_BUTTON (combo_button)); - g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); - - priv = combo_button->priv; - - gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf); -} - -void -gdl_combo_button_set_label (GdlComboButton *combo_button, - const gchar *label) -{ - GdlComboButtonPrivate *priv; - - g_return_if_fail (GDL_IS_COMBO_BUTTON (combo_button)); - g_return_if_fail (label != NULL); - - priv = combo_button->priv; - - gtk_label_set_text (GTK_LABEL (priv->label), label); -} - -void -gdl_combo_button_set_menu (GdlComboButton *combo_button, - GtkMenu *menu) -{ - GdlComboButtonPrivate *priv; - - g_return_if_fail (GDL_IS_COMBO_BUTTON (combo_button)); - g_return_if_fail (GTK_IS_MENU (menu)); - - priv = combo_button->priv; - - if (priv->menu != NULL) - gtk_menu_detach (GTK_MENU (priv->menu)); - - priv->menu = GTK_WIDGET (menu); - if (menu == NULL) - return; - - gtk_menu_attach_to_widget (menu, GTK_WIDGET (combo_button), menu_detacher); - - g_signal_connect (G_OBJECT (menu), "deactivate", - G_CALLBACK (menu_deactivate_cb), combo_button); -} diff --git a/src/libgdl/gdl-combo-button.h b/src/libgdl/gdl-combo-button.h deleted file mode 100644 index 6e80af0b6..000000000 --- a/src/libgdl/gdl-combo-button.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * gdl-combo-button.h - * - * Copyright (C) 2003 Jeroen Zwartepoorte - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _GDL_COMBO_BUTTON_H_ -#define _GDL_COMBO_BUTTON_H_ - -#include -#include -#include - -G_BEGIN_DECLS - -#define GDL_TYPE_COMBO_BUTTON (gdl_combo_button_get_type ()) -#define GDL_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDL_TYPE_COMBO_BUTTON, GdlComboButton)) -#define GDL_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDL_TYPE_COMBO_BUTTON, GdlComboButtonClass)) -#define GDL_IS_COMBO_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDL_TYPE_COMBO_BUTTON)) -#define GDL_IS_COMBO_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GDL_TYPE_COMBO_BUTTON)) - -typedef struct _GdlComboButton GdlComboButton; -typedef struct _GdlComboButtonPrivate GdlComboButtonPrivate; -typedef struct _GdlComboButtonClass GdlComboButtonClass; - -struct _GdlComboButton { - GtkHBox parent; - - GdlComboButtonPrivate *priv; -}; - -struct _GdlComboButtonClass { - GtkHBoxClass parent_class; - - /* Signals. */ - void (* activate_default) (GdlComboButton *combo_button); -}; - -GType gdl_combo_button_get_type (void); -GtkWidget *gdl_combo_button_new (void); - -void gdl_combo_button_set_icon (GdlComboButton *combo_button, - GdkPixbuf *pixbuf); -void gdl_combo_button_set_label (GdlComboButton *combo_button, - const gchar *label); -void gdl_combo_button_set_menu (GdlComboButton *combo_button, - GtkMenu *menu); - -G_END_DECLS - -#endif /* _GDL_COMBO_BUTTON_H_ */ diff --git a/src/libgdl/libgdl.h b/src/libgdl/libgdl.h index 33f520724..5ee84e1ae 100644 --- a/src/libgdl/libgdl.h +++ b/src/libgdl/libgdl.h @@ -32,7 +32,6 @@ #include "libgdl/gdl-dock-notebook.h" #include "libgdl/gdl-dock-tablabel.h" #include "libgdl/gdl-dock-bar.h" -#include "libgdl/gdl-combo-button.h" #include "libgdl/gdl-switcher.h" #endif