diff options
author | JP Rosevear <jpr@novell.com> | 2004-11-26 23:15:36 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2004-11-26 23:15:36 +0800 |
commit | ba0bc7dff09ade6b8014183c44c4c44b42ed1396 (patch) | |
tree | 0394c1dde4cb58e40b4694e0a486f5e37f147750 | |
parent | f484ce17b3651e8d741e789621f59baef1652974 (diff) | |
download | gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar.gz gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar.bz2 gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar.lz gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar.xz gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.tar.zst gsoc2013-evolution-ba0bc7dff09ade6b8014183c44c4c44b42ed1396.zip |
test prog
2004-11-26 JP Rosevear <jpr@novell.com>
* test-info-label.c: test prog
* e-url-entry.c: get image directly from icon factory
* e-combo-button.c: ditto; convert to G_DEFINE_TYPE
* e-activity-handler.c: convert to G_DEFINE_TYPE
* e-task-widget.c: ditto
* e-task-bar.c: ditto
* e-multi-config-dialog.c: ditto
* e-dropdown-button.c: ditto
* e-cell-renderer-combo.c: ditto
* e-cell-date-edit.c: ditto
* e-calendar.c: ditto
* e-calendar-item.c: ditto
* Makefile.am: don't build the title bar, build an info label test
program
svn path=/trunk/; revision=27999
-rw-r--r-- | widgets/misc/.cvsignore | 7 | ||||
-rw-r--r-- | widgets/misc/ChangeLog | 29 | ||||
-rw-r--r-- | widgets/misc/Makefile.am | 12 | ||||
-rw-r--r-- | widgets/misc/e-activity-handler.c | 26 | ||||
-rw-r--r-- | widgets/misc/e-calendar-item.c | 30 | ||||
-rw-r--r-- | widgets/misc/e-calendar.c | 26 | ||||
-rw-r--r-- | widgets/misc/e-cell-date-edit.c | 19 | ||||
-rw-r--r-- | widgets/misc/e-cell-percent.c | 18 | ||||
-rw-r--r-- | widgets/misc/e-cell-renderer-combo.c | 22 | ||||
-rw-r--r-- | widgets/misc/e-combo-button.c | 43 | ||||
-rw-r--r-- | widgets/misc/e-config-page.c | 14 | ||||
-rw-r--r-- | widgets/misc/e-dropdown-button.c | 23 | ||||
-rw-r--r-- | widgets/misc/e-multi-config-dialog.c | 16 | ||||
-rw-r--r-- | widgets/misc/e-task-bar.c | 16 | ||||
-rw-r--r-- | widgets/misc/e-task-widget.c | 22 | ||||
-rw-r--r-- | widgets/misc/e-title-bar.c | 404 | ||||
-rw-r--r-- | widgets/misc/e-title-bar.h | 86 | ||||
-rw-r--r-- | widgets/misc/e-url-entry.c | 5 | ||||
-rw-r--r-- | widgets/misc/test-info-label.c (renamed from widgets/misc/test-title-bar.c) | 14 |
19 files changed, 136 insertions, 696 deletions
diff --git a/widgets/misc/.cvsignore b/widgets/misc/.cvsignore index 8f7925a69c..d3fadaba27 100644 --- a/widgets/misc/.cvsignore +++ b/widgets/misc/.cvsignore @@ -12,4 +12,9 @@ test-dateedit test-dropdown-button test-error test-multi-config-dialog -test-title-bar +test-info-label + + + + + diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index b28e4bf06c..9b02d98ea1 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,32 @@ +2004-11-26 JP Rosevear <jpr@novell.com> + + * test-info-label.c: test prog + + * e-url-entry.c: get image directly from icon factory + + * e-combo-button.c: ditto; convert to G_DEFINE_TYPE + + * e-activity-handler.c: convert to G_DEFINE_TYPE + + * e-task-widget.c: ditto + + * e-task-bar.c: ditto + + * e-multi-config-dialog.c: ditto + + * e-dropdown-button.c: ditto + + * e-cell-renderer-combo.c: ditto + + * e-cell-date-edit.c: ditto + + * e-calendar.c: ditto + + * e-calendar-item.c: ditto + + * Makefile.am: don't build the title bar, build an info label test + program + 2004-10-28 Li Yuan <li.yuan@sun.com> * e-calendar.c: (e_calendar_init), (e_calendar_new): Make diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index 73434f1cd3..0d792bff5e 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -43,7 +43,6 @@ widgetsinclude_HEADERS = \ e-search-bar.h \ e-task-bar.h \ e-task-widget.h \ - e-title-bar.h \ e-url-entry.h libemiscwidgets_la_SOURCES = \ @@ -72,7 +71,6 @@ libemiscwidgets_la_SOURCES = \ e-search-bar.c \ e-task-bar.c \ e-task-widget.c \ - e-title-bar.c \ e-url-entry.c MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h @@ -100,7 +98,7 @@ noinst_PROGRAMS = \ test-dropdown-button \ test-error \ test-multi-config-dialog \ - test-title-bar + test-info-label # test-calendar @@ -142,12 +140,12 @@ test_multi_config_dialog_LDADD = \ $(top_builddir)/e-util/libeutil.la \ $(E_WIDGETS_LIBS) -# test-title-bar +# test-info-label -test_title_bar_SOURCES = \ - test-title-bar.c +test_info_label_SOURCES = \ + test-info-label.c -test_title_bar_LDADD = \ +test_info_label_LDADD = \ ./libemiscwidgets.la \ $(top_builddir)/e-util/libeutil.la \ $(E_WIDGETS_LIBS) diff --git a/widgets/misc/e-activity-handler.c b/widgets/misc/e-activity-handler.c index fd5fb9a275..cdbe7518b5 100644 --- a/widgets/misc/e-activity-handler.c +++ b/widgets/misc/e-activity-handler.c @@ -32,14 +32,8 @@ #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-popup-menu.h> -#include <gal/util/e-util.h> #include <gal/widgets/e-popup-menu.h> - -#define PARENT_TYPE G_TYPE_OBJECT -static GObjectClass *parent_class = NULL; - - #define ICON_SIZE 16 @@ -55,11 +49,12 @@ struct _ActivityInfo { typedef struct _ActivityInfo ActivityInfo; struct _EActivityHandlerPrivate { - uint next_activity_id; + guint next_activity_id; GList *activity_infos; GSList *task_bars; }; +G_DEFINE_TYPE (EActivityHandler, e_activity_handler, G_TYPE_OBJECT) /* Utility functions. */ @@ -230,7 +225,7 @@ impl_dispose (GObject *object) g_object_weak_unref (G_OBJECT (sp->data), task_bar_destroy_notify, handler); priv->task_bars = NULL; - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + (* G_OBJECT_CLASS (e_activity_handler_parent_class)->dispose) (object); } static void @@ -244,23 +239,20 @@ impl_finalize (GObject *object) g_free (priv); - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + (* G_OBJECT_CLASS (e_activity_handler_parent_class)->finalize) (object); } - -/* GTK+ type stuff. */ - static void -class_init (GObjectClass *object_class) +e_activity_handler_class_init (EActivityHandlerClass *activity_handler_class) { - parent_class = g_type_class_ref(PARENT_TYPE); - + GObjectClass *object_class = (GObjectClass *) activity_handler_class; + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; } static void -init (EActivityHandler *activity_handler) +e_activity_handler_init (EActivityHandler *activity_handler) { EActivityHandlerPrivate *priv; @@ -416,5 +408,3 @@ e_activity_handler_operation_finished (EActivityHandler *activity_handler, } } - -E_MAKE_TYPE (e_activity_handler, "EActivityHandler", EActivityHandler, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c index 8bf9db8e0b..4765bdb8d5 100644 --- a/widgets/misc/e-calendar-item.c +++ b/widgets/misc/e-calendar-item.c @@ -55,8 +55,6 @@ static const int e_calendar_item_days_in_month[12] = { && ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))) ? 1 : 0) -static void e_calendar_item_class_init (ECalendarItemClass *class); -static void e_calendar_item_init (ECalendarItem *calitem); static void e_calendar_item_destroy (GtkObject *o); static void e_calendar_item_get_arg (GtkObject *o, GtkArg *arg, @@ -237,13 +235,9 @@ enum { }; -static GnomeCanvasItemClass *parent_class; static guint e_calendar_item_signals[LAST_SIGNAL] = { 0 }; - -E_MAKE_TYPE (e_calendar_item, "ECalendarItem", ECalendarItem, - e_calendar_item_class_init, e_calendar_item_init, - GNOME_TYPE_CANVAS_ITEM) +G_DEFINE_TYPE (ECalendarItem, e_calendar_item, GNOME_TYPE_CANVAS_ITEM) static void @@ -252,8 +246,6 @@ e_calendar_item_class_init (ECalendarItemClass *class) GtkObjectClass *object_class; GnomeCanvasItemClass *item_class; - parent_class = g_type_class_peek_parent (class); - object_class = GTK_OBJECT_CLASS (class); item_class = GNOME_CANVAS_ITEM_CLASS (class); @@ -458,8 +450,8 @@ e_calendar_item_destroy (GtkObject *o) if (calitem->selecting_axis) g_free (calitem->selecting_axis); - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (o); + if (GTK_OBJECT_CLASS (e_calendar_item_parent_class)->destroy) + (* GTK_OBJECT_CLASS (e_calendar_item_parent_class)->destroy) (o); } @@ -692,8 +684,8 @@ e_calendar_item_realize (GnomeCanvasItem *item) gboolean success[E_CALENDAR_ITEM_COLOR_LAST]; gint nfailed; - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->realize) (item); + if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->realize) + (* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->realize) (item); calitem = E_CALENDAR_ITEM (item); @@ -744,8 +736,8 @@ e_calendar_item_unrealize (GnomeCanvasItem *item) gdk_colors_free (colormap, (gulong *) &calitem->colors[i].pixel, 1, 0); } - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item); + if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unrealize) + (* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unrealize) (item); } @@ -761,8 +753,8 @@ e_calendar_item_unmap (GnomeCanvasItem *item) calitem->selecting = FALSE; } - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unmap) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->unmap) (item); + if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unmap) + (* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->unmap) (item); } @@ -780,8 +772,8 @@ e_calendar_item_update (GnomeCanvasItem *item, PangoContext *pango_context; PangoFontMetrics *font_metrics; - if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update) - (* GNOME_CANVAS_ITEM_CLASS (parent_class)->update) (item, affine, clip_path, flags); + if (GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->update) + (* GNOME_CANVAS_ITEM_CLASS (e_calendar_item_parent_class)->update) (item, affine, clip_path, flags); calitem = E_CALENDAR_ITEM (item); style = GTK_WIDGET (item->canvas)->style; diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c index 5fca4ab074..c8798b5cfa 100644 --- a/widgets/misc/e-calendar.c +++ b/widgets/misc/e-calendar.c @@ -30,7 +30,9 @@ * to got to the current day. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include "e-calendar.h" @@ -41,7 +43,6 @@ #include <gtk/gtkpixmap.h> #include <gtk/gtksignal.h> #include <libgnomecanvas/gnome-canvas-widget.h> -#include <gal/util/e-util.h> #include <libgnome/gnome-i18n.h> #define E_CALENDAR_SMALL_FONT_PTSIZE 6 @@ -70,8 +71,6 @@ #define E_CALENDAR_AUTO_MOVE_TIMEOUT 150 #define E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY 2 -static void e_calendar_class_init (ECalendarClass *class); -static void e_calendar_init (ECalendar *cal); static void e_calendar_destroy (GtkObject *object); static void e_calendar_realize (GtkWidget *widget); static void e_calendar_style_set (GtkWidget *widget, @@ -104,11 +103,7 @@ static void e_calendar_start_auto_move (ECalendar *cal, static gboolean e_calendar_auto_move_handler (gpointer data); static void e_calendar_stop_auto_move (ECalendar *cal); -static GnomeCanvasClass *parent_class; -static GtkLayoutClass *grandparent_class; - -E_MAKE_TYPE (e_calendar, "ECalendar", ECalendar, - e_calendar_class_init, e_calendar_init, E_CANVAS_TYPE) +G_DEFINE_TYPE (ECalendar, e_calendar, E_CANVAS_TYPE) static void @@ -120,9 +115,6 @@ e_calendar_class_init (ECalendarClass *class) object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; - parent_class = g_type_class_ref(E_CANVAS_TYPE); - grandparent_class = g_type_class_ref(GTK_TYPE_LAYOUT); - object_class->destroy = e_calendar_destroy; widget_class->realize = e_calendar_realize; @@ -252,15 +244,15 @@ e_calendar_destroy (GtkObject *object) cal->timeout_id = 0; } - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (GTK_OBJECT_CLASS (e_calendar_parent_class)->destroy) + (* GTK_OBJECT_CLASS (e_calendar_parent_class)->destroy) (object); } static void e_calendar_realize (GtkWidget *widget) { - (*GTK_WIDGET_CLASS (parent_class)->realize) (widget); + (*GTK_WIDGET_CLASS (e_calendar_parent_class)->realize) (widget); /* Set the background of the canvas window to the normal color, or the arrow buttons are not displayed properly. */ @@ -273,8 +265,8 @@ static void e_calendar_style_set (GtkWidget *widget, GtkStyle *previous_style) { - if (GTK_WIDGET_CLASS (parent_class)->style_set) - (*GTK_WIDGET_CLASS (parent_class)->style_set) (widget, + if (GTK_WIDGET_CLASS (e_calendar_parent_class)->style_set) + (*GTK_WIDGET_CLASS (e_calendar_parent_class)->style_set) (widget, previous_style); /* Set the background of the canvas window to the normal color, @@ -324,7 +316,7 @@ e_calendar_size_allocate (GtkWidget *widget, xthickness = widget->style->xthickness; ythickness = widget->style->ythickness; - (*GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation); + (*GTK_WIDGET_CLASS (e_calendar_parent_class)->size_allocate) (widget, allocation); /* Set up Pango prerequisites */ font_desc = gtk_widget_get_style (widget)->font_desc; diff --git a/widgets/misc/e-cell-date-edit.c b/widgets/misc/e-cell-date-edit.c index 5564f20ea6..12167e3185 100644 --- a/widgets/misc/e-cell-date-edit.c +++ b/widgets/misc/e-cell-date-edit.c @@ -40,7 +40,6 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> -#include <gal/util/e-util.h> #include <gal/e-table/e-table-item.h> #include <gal/e-table/e-cell-text.h> @@ -51,8 +50,6 @@ /* This depends on ECalendar which is why I didn't put it in gal. */ #include "e-calendar.h" -static void e_cell_date_edit_class_init (GtkObjectClass *object_class); -static void e_cell_date_edit_init (ECellDateEdit *ecde); static void e_cell_date_edit_destroy (GtkObject *object); static void e_cell_date_edit_get_arg (GtkObject *o, GtkArg *arg, @@ -115,18 +112,14 @@ enum { ARG_UPPER_HOUR }; -static ECellPopupClass *parent_class; - - -E_MAKE_TYPE (e_cell_date_edit, "ECellDateEdit", ECellDateEdit, - e_cell_date_edit_class_init, e_cell_date_edit_init, - e_cell_popup_get_type()); +G_DEFINE_TYPE (ECellDateEdit, e_cell_date_edit, E_CELL_POPUP_TYPE); static void -e_cell_date_edit_class_init (GtkObjectClass *object_class) +e_cell_date_edit_class_init (ECellDateEditClass *ecdec) { - ECellPopupClass *ecpc = (ECellPopupClass *) object_class; + GtkObjectClass *object_class = (GtkObjectClass *) ecdec; + ECellPopupClass *ecpc = (ECellPopupClass *) ecdec; gtk_object_add_arg_type ("ECellDateEdit::show_time", GTK_TYPE_BOOL, GTK_ARG_READWRITE, @@ -155,8 +148,6 @@ e_cell_date_edit_class_init (GtkObjectClass *object_class) object_class->set_arg = e_cell_date_edit_set_arg; ecpc->popup = e_cell_date_edit_do_popup; - - parent_class = g_type_class_ref(e_cell_popup_get_type ()); } @@ -310,7 +301,7 @@ e_cell_date_edit_destroy (GtkObject *object) gtk_widget_destroy (ecde->popup_window); ecde->popup_window = NULL; - GTK_OBJECT_CLASS (parent_class)->destroy (object); + GTK_OBJECT_CLASS (e_cell_date_edit_parent_class)->destroy (object); } diff --git a/widgets/misc/e-cell-percent.c b/widgets/misc/e-cell-percent.c index 82ab3a72f8..b2ccf1def9 100644 --- a/widgets/misc/e-cell-percent.c +++ b/widgets/misc/e-cell-percent.c @@ -26,22 +26,21 @@ * in an ETable. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif #include <ctype.h> #include <sys/time.h> #include <unistd.h> #include <stdio.h> -#include <gal/util/e-util.h> #include <libgnomeui/gnome-messagebox.h> #include <libgnome/gnome-i18n.h> #include "e-cell-percent.h" -#define PARENT_TYPE e_cell_text_get_type () - -static ECellTextClass *parent_class; +G_DEFINE_TYPE (ECellPercent, e_cell_percent, E_CELL_TEXT_TYPE); static char * @@ -115,11 +114,9 @@ ecp_set_value (ECellText *cell, ETableModel *model, int col, int row, } static void -e_cell_percent_class_init (GtkObjectClass *object_class) +e_cell_percent_class_init (ECellPercentClass *ecpc) { - ECellTextClass *ectc = (ECellTextClass *) object_class; - - parent_class = g_type_class_ref(PARENT_TYPE); + ECellTextClass *ectc = (ECellTextClass *) ecpc; ectc->get_text = ecp_get_text; ectc->free_text = ecp_free_text; @@ -127,7 +124,7 @@ e_cell_percent_class_init (GtkObjectClass *object_class) } static void -e_cell_percent_init (GtkObject *object) +e_cell_percent_init (ECellPercent *ecp) { } @@ -153,6 +150,3 @@ e_cell_percent_new (const char *fontname, GtkJustification justify) return (ECell *) ecn; } - -E_MAKE_TYPE (e_cell_percent, "ECellPercent", ECellPercent, - e_cell_percent_class_init, e_cell_percent_init, PARENT_TYPE); diff --git a/widgets/misc/e-cell-renderer-combo.c b/widgets/misc/e-cell-renderer-combo.c index 8ead96c4e8..562d940582 100644 --- a/widgets/misc/e-cell-renderer-combo.c +++ b/widgets/misc/e-cell-renderer-combo.c @@ -20,11 +20,13 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + #include <gtk/gtkcellrenderertext.h> #include <gtk/gtkarrow.h> #include <gtk/gtkbutton.h> -#include <gal/util/e-util.h> #include "e-combo-cell-editable.h" #include "e-cell-renderer-combo.h" @@ -40,7 +42,7 @@ struct _ECellRendererComboPriv { GList *list; }; -static GtkCellRendererTextClass *parent_class; +G_DEFINE_TYPE (ECellRendererCombo, e_cell_renderer_combo, GTK_TYPE_CELL_RENDERER_TEXT) static void ecrc_editing_done (GtkCellEditable *editable, ECellRendererCombo *cell) @@ -88,8 +90,8 @@ ecrc_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area GtkWidget *btn; GtkRequisition req; - if (GTK_CELL_RENDERER_CLASS (parent_class)->get_size) - GTK_CELL_RENDERER_CLASS (parent_class)->get_size (cell, widget, cell_area, x_offset, y_offset, width, height); + if (GTK_CELL_RENDERER_CLASS (e_cell_renderer_combo_parent_class)->get_size) + GTK_CELL_RENDERER_CLASS (e_cell_renderer_combo_parent_class)->get_size (cell, widget, cell_area, x_offset, y_offset, width, height); btn = gtk_button_new (); gtk_container_add (GTK_CONTAINER (btn), gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE)); @@ -141,24 +143,22 @@ ecrc_finalize (GObject *obj) g_free (cell->priv); - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (obj); + if (G_OBJECT_CLASS (e_cell_renderer_combo_parent_class)->finalize) + G_OBJECT_CLASS (e_cell_renderer_combo_parent_class)->finalize (obj); } static void -ecrc_init (ECellRendererCombo *cell) +e_cell_renderer_combo_init (ECellRendererCombo *cell) { cell->priv = g_new0 (ECellRendererComboPriv, 1); } static void -ecrc_class_init (ECellRendererComboClass *class) +e_cell_renderer_combo_class_init (ECellRendererComboClass *class) { GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS (class); GObjectClass *obj_class = G_OBJECT_CLASS (class); - parent_class = GTK_CELL_RENDERER_TEXT_CLASS (g_type_class_peek_parent (class)); - obj_class->get_property = ecrc_get_prop; obj_class->set_property = ecrc_set_prop; obj_class->finalize = ecrc_finalize; @@ -170,8 +170,6 @@ ecrc_class_init (ECellRendererComboClass *class) g_param_spec_pointer ("list", "List", "List of items to popup.", G_PARAM_READWRITE)); } -E_MAKE_TYPE (e_cell_renderer_combo, "ECellRendererCombo", ECellRendererCombo, ecrc_class_init, ecrc_init, GTK_TYPE_CELL_RENDERER_TEXT) - GtkCellRenderer * e_cell_renderer_combo_new (void) { diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c index e336e88906..66706c1f21 100644 --- a/widgets/misc/e-combo-button.c +++ b/widgets/misc/e-combo-button.c @@ -34,9 +34,6 @@ #include <gtk/gtkimage.h> #include <gtk/gtksignal.h> -#include <gal/util/e-util.h> - - struct _EComboButtonPrivate { GdkPixbuf *icon; @@ -50,13 +47,8 @@ struct _EComboButtonPrivate { gboolean menu_popped_up; }; - #define SPACING 2 - -#define PARENT_TYPE gtk_button_get_type () -static GtkButtonClass *parent_class = NULL; - enum { ACTIVATE_DEFAULT, LAST_SIGNAL @@ -64,23 +56,9 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; - -/* Utility functions. */ - -static GtkWidget * -create_empty_image_widget (void) -{ - GtkWidget *image_widget; - GdkPixbuf *pixbuf; +G_DEFINE_TYPE (EComboButton, e_combo_button, GTK_TYPE_BUTTON) - pixbuf = e_icon_factory_get_icon (NULL, E_ICON_SIZE_MENU); - - image_widget = gtk_image_new_from_pixbuf (pixbuf); - - g_object_unref (pixbuf); - - return image_widget; -} +/* Utility functions. */ static void set_icon (EComboButton *combo_button, @@ -269,7 +247,7 @@ impl_destroy (GtkObject *object) combo_button->priv = NULL; } - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + (* GTK_OBJECT_CLASS (e_combo_button_parent_class)->destroy) (object); } @@ -323,7 +301,7 @@ impl_leave_notify_event (GtkWidget *widget, have just popped up the menu. Otherwise, the button would look as inactive when the menu is popped up. */ if (! priv->menu_popped_up) - return (* GTK_WIDGET_CLASS (parent_class)->leave_notify_event) (widget, event); + return (* GTK_WIDGET_CLASS (e_combo_button_parent_class)->leave_notify_event) (widget, event); return FALSE; } @@ -392,13 +370,13 @@ impl_released (GtkButton *button) static void -class_init (GtkObjectClass *object_class) +e_combo_button_class_init (EComboButtonClass *combo_button_class) { + GtkObjectClass *object_class; GtkWidgetClass *widget_class; GtkButtonClass *button_class; - parent_class = g_type_class_ref(PARENT_TYPE); - + object_class = GTK_OBJECT_CLASS (combo_button_class); object_class->destroy = impl_destroy; widget_class = GTK_WIDGET_CLASS (object_class); @@ -418,7 +396,7 @@ class_init (GtkObjectClass *object_class) } static void -init (EComboButton *combo_button) +e_combo_button_init (EComboButton *combo_button) { EComboButtonPrivate *priv; @@ -429,7 +407,7 @@ init (EComboButton *combo_button) gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox); gtk_widget_show (priv->hbox); - priv->icon_image = create_empty_image_widget (); + priv->icon_image = e_icon_factory_get_image (NULL, E_ICON_SIZE_MENU); gtk_box_pack_start (GTK_BOX (priv->hbox), priv->icon_image, TRUE, TRUE, 0); gtk_widget_show (priv->icon_image); @@ -531,6 +509,3 @@ e_combo_button_set_menu (EComboButton *combo_button, G_CALLBACK (menu_deactivate_callback), combo_button); } - - -E_MAKE_TYPE (e_combo_button, "EComboButton", EComboButton, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-config-page.c b/widgets/misc/e-config-page.c index 3140850185..16218f736b 100644 --- a/widgets/misc/e-config-page.c +++ b/widgets/misc/e-config-page.c @@ -27,27 +27,21 @@ #include "e-config-page.h" -#include <gal/util/e-util.h> - -#define PARENT_TYPE gtk_event_box_get_type () -static GtkEventBoxClass *parent_class = NULL; +G_DEFINE_TYPE (EConfigPage, e_config_page, GTK_TYPE_EVENT_BOX) /* GObject methods. */ static void -class_init (EConfigPageClass *class) +e_config_page_class_init (EConfigPageClass *class) { GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); - - parent_class = g_type_class_ref(PARENT_TYPE); } static void -init (EConfigPage *page, EConfigPageClass *klass) +e_config_page_init (EConfigPage *page) { - ; } GtkWidget * @@ -56,4 +50,4 @@ e_config_page_new (void) return gtk_type_new (e_config_page_get_type ()); } -E_MAKE_TYPE (e_config_page, "EConfigPage", EConfigPage, class_init, init, PARENT_TYPE) + diff --git a/widgets/misc/e-dropdown-button.c b/widgets/misc/e-dropdown-button.c index 4a0327e7be..480e7d04c1 100644 --- a/widgets/misc/e-dropdown-button.c +++ b/widgets/misc/e-dropdown-button.c @@ -28,24 +28,19 @@ #include "e-dropdown-button.h" - #include <stdio.h> #include <gtk/gtkarrow.h> #include <gtk/gtklabel.h> #include <gtk/gtkwidget.h> #include <libgnomeui/gnome-popup-menu.h> -#include <gal/util/e-util.h> - struct _EDropdownButtonPrivate { GtkAccelGroup *accel_group; GtkWidget *menu; }; -#define PARENT_TYPE gtk_toggle_button_get_type () -static GtkToggleButtonClass *parent_class = NULL; +G_DEFINE_TYPE (EDropdownButton, e_dropdown_button, GTK_TYPE_TOGGLE_BUTTON) - /* Callback to position the pop-up menu. */ static void @@ -109,8 +104,8 @@ impl_destroy (GtkObject *object) g_free (priv); - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); + if (GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy) + (* GTK_OBJECT_CLASS (e_dropdown_button_parent_class)->destroy) (object); } @@ -122,8 +117,8 @@ impl_toggled (GtkToggleButton *toggle_button) EDropdownButton *dropdown_button; EDropdownButtonPrivate *priv; - if (parent_class->toggled) - parent_class->toggled (toggle_button); + if (GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled) + GTK_TOGGLE_BUTTON_CLASS (e_dropdown_button_parent_class)->toggled (toggle_button); dropdown_button = E_DROPDOWN_BUTTON (toggle_button); priv = dropdown_button->priv; @@ -139,7 +134,7 @@ impl_toggled (GtkToggleButton *toggle_button) static void -class_init (EDropdownButtonClass *klass) +e_dropdown_button_class_init (EDropdownButtonClass *klass) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; @@ -151,13 +146,11 @@ class_init (EDropdownButtonClass *klass) object_class->destroy = impl_destroy; toggle_class->toggled = impl_toggled; - - parent_class = g_type_class_ref(PARENT_TYPE); } static void -init (EDropdownButton *dropdown_button) +e_dropdown_button_init (EDropdownButton *dropdown_button) { EDropdownButtonPrivate *priv; @@ -245,5 +238,3 @@ e_dropdown_button_new (const char *label_text, return widget; } - -E_MAKE_TYPE (e_dropdown_button, "EDropdownButton", EDropdownButton, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c index 71b9457e7d..499ef97554 100644 --- a/widgets/misc/e-multi-config-dialog.c +++ b/widgets/misc/e-multi-config-dialog.c @@ -37,12 +37,8 @@ #include <gdk-pixbuf/gdk-pixbuf.h> -#define PARENT_TYPE gtk_dialog_get_type () -static GtkDialogClass *parent_class = NULL; - #define SWITCH_PAGE_INTERVAL 250 - struct _EMultiConfigDialogPrivate { GSList *pages; @@ -55,6 +51,8 @@ struct _EMultiConfigDialogPrivate { int set_page_timeout_page; }; +G_DEFINE_TYPE (EMultiConfigDialog, e_multi_config_dialog, GTK_TYPE_DIALOG) + /* ETable stuff. */ @@ -177,7 +175,7 @@ impl_finalize (GObject *object) g_free (priv); - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + (* G_OBJECT_CLASS (e_multi_config_dialog_parent_class)->finalize) (object); } @@ -216,7 +214,7 @@ impl_response (GtkDialog *dialog, int response_id) /* GObject ctors. */ static void -class_init (EMultiConfigDialogClass *class) +e_multi_config_dialog_class_init (EMultiConfigDialogClass *class) { GObjectClass *object_class; GtkDialogClass *dialog_class; @@ -226,8 +224,6 @@ class_init (EMultiConfigDialogClass *class) dialog_class = GTK_DIALOG_CLASS (class); dialog_class->response = impl_response; - - parent_class = g_type_class_ref (PARENT_TYPE); } #define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \ @@ -287,7 +283,7 @@ static ETableMemoryStoreColumnInfo columns[] = { }; static void -init (EMultiConfigDialog *multi_config_dialog) +e_multi_config_dialog_init (EMultiConfigDialog *multi_config_dialog) { EMultiConfigDialogPrivate *priv; ETableModel *list_e_table_model; @@ -449,5 +445,3 @@ e_multi_config_dialog_show_page (EMultiConfigDialog *dialog, int page) gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), page); } - -E_MAKE_TYPE (e_multi_config_dialog, "EMultiConfigDialog", EMultiConfigDialog, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-task-bar.c b/widgets/misc/e-task-bar.c index bb1fdb96ff..3ed243e18f 100644 --- a/widgets/misc/e-task-bar.c +++ b/widgets/misc/e-task-bar.c @@ -26,24 +26,19 @@ #include "e-task-bar.h" -#include <gal/util/e-util.h> #include "widgets/misc/e-clipped-label.h" - struct _ETaskBarPrivate { EClippedLabel *message_label; GtkHBox *hbox; }; -#define PARENT_TYPE gtk_hbox_get_type () -static GtkHBoxClass *parent_class = NULL; - - /* WARNING: Ugly hack starts here. */ - #define MAX_ACTIVITIES_PER_COMPONENT 2 +G_DEFINE_TYPE (ETaskBar, e_task_bar, GTK_TYPE_HBOX) + static void reduce_displayed_activities_per_component (ETaskBar *task_bar) { @@ -89,13 +84,12 @@ reduce_displayed_activities_per_component (ETaskBar *task_bar) static void -class_init (GtkObjectClass *object_class) +e_task_bar_class_init (ETaskBarClass *klass) { - parent_class = g_type_class_ref(PARENT_TYPE); } static void -init (ETaskBar *task_bar) +e_task_bar_init (ETaskBar *task_bar) { GtkWidget *label, *hbox; @@ -227,5 +221,3 @@ e_task_bar_get_task_widget (ETaskBar *task_bar, return E_TASK_WIDGET (child_info->widget); } - -E_MAKE_TYPE (e_task_bar, "ETaskBar", ETaskBar, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-task-widget.c b/widgets/misc/e-task-widget.c index ab610f77f9..c7621d61fc 100644 --- a/widgets/misc/e-task-widget.c +++ b/widgets/misc/e-task-widget.c @@ -34,14 +34,9 @@ #include <libgnome/gnome-i18n.h> -#include <gal/util/e-util.h> - #define SPACING 2 -#define PARENT_TYPE (gtk_event_box_get_type ()) -static GtkEventBoxClass *parent_class = NULL; - struct _ETaskWidgetPrivate { char *component_id; @@ -52,7 +47,8 @@ struct _ETaskWidgetPrivate { GtkWidget *image; }; - +G_DEFINE_TYPE (ETaskWidget, e_task_widget, GTK_TYPE_EVENT_BOX) + /* GObject methods. */ static void @@ -75,7 +71,7 @@ impl_dispose (GObject *object) priv->icon_pixbuf = NULL; } - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + (* G_OBJECT_CLASS (e_task_widget_parent_class)->dispose) (object); } static void @@ -90,21 +86,21 @@ impl_finalize (GObject *object) g_free (priv->component_id); g_free (priv); - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + (* G_OBJECT_CLASS (e_task_widget_parent_class)->finalize) (object); } static void -class_init (GObjectClass *object_class) +e_task_widget_class_init (ETaskWidgetClass *klass) { - parent_class = g_type_class_ref(PARENT_TYPE); - + GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->dispose = impl_dispose; object_class->finalize = impl_finalize; } static void -init (ETaskWidget *task_widget) +e_task_widget_init (ETaskWidget *task_widget) { ETaskWidgetPrivate *priv; @@ -248,5 +244,3 @@ e_task_widget_get_component_id (ETaskWidget *task_widget) return task_widget->priv->component_id; } - -E_MAKE_TYPE (e_task_widget, "ETaskWidget", ETaskWidget, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-title-bar.c b/widgets/misc/e-title-bar.c deleted file mode 100644 index 4d4e36e45b..0000000000 --- a/widgets/misc/e-title-bar.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-title-bar.c - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkbox.h> -#include <gtk/gtkbutton.h> -#include <gtk/gtkhbox.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkpixmap.h> -#include <gtk/gtksignal.h> -#include <gtk/gtktypeutils.h> - -#include <gal/util/e-util.h> -#include "e-clipped-label.h" - -#include "e-title-bar.h" - - -enum { - LABEL_BUTTON_PRESS_EVENT, - BUTTON_CLICKED, - LAST_SIGNAL -}; -static guint signals[LAST_SIGNAL] = { 0 }; - - -/* The pixmaps. */ - -static char *close_xpm[] = { - "16 16 2 1", - " c none", - ". c #000000000000", - " ", - " ", - " ", - " .. .. ", - " ... ... ", - " ... ... ", - " ...... ", - " .... ", - " .... ", - " ...... ", - " ... ... ", - " ... ... ", - " .. .. ", - " ", - " ", - " " -}; - -static char *pin_xpm[] = { - "16 16 33 1", - " c None", - ". c #000000", - "+ c #74744D", - "@ c #B2B279", - "# c #6C6C46", - "$ c #CACA9C", - "% c #F4F4AD", - "& c #85855A", - "* c #B1B175", - "= c #9A9A66", - "- c #A9A98A", - "; c #B0B07B", - "> c #535353", - ", c #818181", - "' c #B7B7B7", - ") c #D8D8D8", - "! c #FFFFFF", - "~ c #EBEBA1", - "{ c #8A8A75", - "] c #9F9F76", - "^ c #9E9E75", - "/ c #8A8A66", - "( c #979770", - "_ c #6B6B46", - ": c #28281A", - "< c #505034", - "[ c #666645", - "} c #61614D", - "| c #818155", - "1 c #4A4A31", - "2 c #4D4D34", - "3 c #6C6C48", - "4 c #5D5D3E", - " ", - " ", - " ", - " . . ", - " .. .+. ", - " .@...#$. ", - " ......%&*=-;. ", - ".>,')!.~{]^/(. ", - " ......_:<[}|. ", - " .1...23. ", - " .. .4. ", - " . . ", - " ", - " ", - " ", - " " -}; - - -#define PARENT_TYPE GTK_TYPE_FRAME -static GtkFrameClass *parent_class = NULL; - -struct _ETitleBarPrivate { - ETitleBarButtonMode button_mode; - GtkWidget *label; - GtkWidget *button; - GtkWidget *close_gtk_pixmap; - GtkWidget *pin_gtk_pixmap; -}; - - -/* Mode handling. We put both the close and pin GtkPixmaps into an hbox in the - button, and hide one of them according to the mode. */ - -static void -show_and_hide_pixmaps_according_to_mode (ETitleBar *title_bar) -{ - ETitleBarPrivate *priv; - - priv = title_bar->priv; - - if (priv->close_gtk_pixmap == NULL || priv->pin_gtk_pixmap == NULL) - return; - - switch (priv->button_mode) { - case E_TITLE_BAR_BUTTON_MODE_PIN: - gtk_widget_hide (priv->close_gtk_pixmap); - gtk_widget_show (priv->pin_gtk_pixmap); - break; - case E_TITLE_BAR_BUTTON_MODE_CLOSE: - gtk_widget_hide (priv->pin_gtk_pixmap); - gtk_widget_show (priv->close_gtk_pixmap); - break; - default: - g_assert_not_reached (); - } -} - - -/* Child signal callbacks. */ - -static void -button_realize_cb (GtkWidget *widget, - gpointer data) -{ - GdkPixmap *close_pixmap; - GdkBitmap *close_mask; - GdkPixmap *pin_pixmap; - GdkBitmap *pin_mask; - GtkWidget *hbox; - ETitleBar *title_bar; - ETitleBarPrivate *priv; - - title_bar = E_TITLE_BAR (data); - priv = title_bar->priv; - - if (priv->close_gtk_pixmap != NULL) - return; - - close_pixmap = gdk_pixmap_create_from_xpm_d (GTK_WIDGET (priv->button)->window, - &close_mask, NULL, close_xpm); - priv->close_gtk_pixmap = gtk_pixmap_new (close_pixmap, close_mask); - - pin_pixmap = gdk_pixmap_create_from_xpm_d (GTK_WIDGET (priv->button)->window, - &pin_mask, NULL, pin_xpm); - priv->pin_gtk_pixmap = gtk_pixmap_new (pin_pixmap, pin_mask); - - hbox = gtk_hbox_new (TRUE, 0); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (hbox), priv->pin_gtk_pixmap, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->close_gtk_pixmap, TRUE, TRUE, 0); - - gtk_container_add (GTK_CONTAINER (priv->button), hbox); - - gdk_pixmap_unref (close_pixmap); - g_object_unref (close_mask); - gdk_pixmap_unref (pin_pixmap); - g_object_unref (pin_mask); - - show_and_hide_pixmaps_according_to_mode (title_bar); -} - -static void -button_clicked_cb (GtkButton *button, - gpointer data) -{ - ETitleBar *title_bar; - - title_bar = E_TITLE_BAR (data); - - gtk_signal_emit (GTK_OBJECT (title_bar), signals[BUTTON_CLICKED]); -} - -static void -label_button_press_event_cb (GtkWidget *widget, - GdkEventButton *event, - gpointer data) -{ - ETitleBar *title_bar; - - title_bar = E_TITLE_BAR (data); - - gtk_signal_emit (GTK_OBJECT (title_bar), signals[LABEL_BUTTON_PRESS_EVENT], event); -} - - -/* GObject methods. */ - -static void -impl_finalize (GObject *object) -{ - ETitleBar *title_bar; - ETitleBarPrivate *priv; - - title_bar = E_TITLE_BAR (object); - priv = title_bar->priv; - - g_free (priv); - - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - -static void -class_init (ETitleBarClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = impl_finalize; - - parent_class = g_type_class_ref(gtk_frame_get_type ()); - - signals[LABEL_BUTTON_PRESS_EVENT] = - gtk_signal_new ("label_button_press_event", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (ETitleBarClass, label_button_press_event), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - signals[BUTTON_CLICKED] = - gtk_signal_new ("button_clicked", - GTK_RUN_FIRST, - GTK_CLASS_TYPE (object_class), - G_STRUCT_OFFSET (ETitleBarClass, button_clicked), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); -} - -static void -init (ETitleBar *title_bar) -{ - ETitleBarPrivate *priv; - - priv = g_new (ETitleBarPrivate, 1); - - priv->button_mode = E_TITLE_BAR_BUTTON_MODE_CLOSE; - priv->label = NULL; - priv->button = NULL; - priv->close_gtk_pixmap = NULL; - priv->pin_gtk_pixmap = NULL; - - title_bar->priv = priv; -} - - -void -e_title_bar_construct (ETitleBar *title_bar, - const char *title) -{ - ETitleBarPrivate *priv; - GtkWidget *hbox; - - g_return_if_fail (title_bar != NULL); - g_return_if_fail (E_IS_TITLE_BAR (title_bar)); - - priv = title_bar->priv; - - priv->label = e_clipped_label_new (title, PANGO_WEIGHT_BOLD, 1.0); - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); - gtk_misc_set_padding (GTK_MISC (priv->label), 2, 0); - gtk_widget_show (priv->label); - - priv->button = gtk_button_new (); - GTK_WIDGET_UNSET_FLAGS (priv->button, GTK_CAN_FOCUS); - gtk_container_set_border_width (GTK_CONTAINER (priv->button), 1); - gtk_button_set_relief (GTK_BUTTON (priv->button), GTK_RELIEF_NONE); - gtk_widget_show (priv->button); - - hbox = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), priv->label, TRUE, TRUE, 2); - gtk_box_pack_start (GTK_BOX (hbox), priv->button, FALSE, TRUE, 1); - gtk_widget_show (hbox); - - gtk_container_add (GTK_CONTAINER (title_bar), hbox); - - g_signal_connect((priv->button), "realize", - G_CALLBACK (button_realize_cb), title_bar); - g_signal_connect((priv->button), "clicked", - G_CALLBACK (button_clicked_cb), title_bar); - g_signal_connect((priv->label), "button_press_event", - G_CALLBACK (label_button_press_event_cb), title_bar); -} - -GtkWidget * -e_title_bar_new (const char *title) -{ - ETitleBar *title_bar; - - title_bar = gtk_type_new (e_title_bar_get_type ()); - - e_title_bar_construct (title_bar, title); - - return GTK_WIDGET (title_bar); -} - - -void -e_title_bar_set_title (ETitleBar *title_bar, - const char *title) -{ - g_return_if_fail (title_bar != NULL); - g_return_if_fail (E_IS_TITLE_BAR (title_bar)); - - e_clipped_label_set_text (E_CLIPPED_LABEL (title_bar->priv->label), title); -} - -void -e_title_bar_show_button (ETitleBar *title_bar, - gboolean show) -{ - ETitleBarPrivate *priv; - - g_return_if_fail (title_bar != NULL); - g_return_if_fail (E_IS_TITLE_BAR (title_bar)); - - priv = title_bar->priv; - - if (show) - gtk_widget_show (priv->button); - else - gtk_widget_hide (priv->button); -} - -void -e_title_bar_set_button_mode (ETitleBar *title_bar, - ETitleBarButtonMode button_mode) -{ - ETitleBarPrivate *priv; - - g_return_if_fail (title_bar != NULL); - g_return_if_fail (E_IS_TITLE_BAR (title_bar)); - g_return_if_fail (button_mode == E_TITLE_BAR_BUTTON_MODE_CLOSE - || button_mode == E_TITLE_BAR_BUTTON_MODE_PIN); - - priv = title_bar->priv; - - if (priv->button_mode == button_mode) - return; - - priv->button_mode = button_mode; - show_and_hide_pixmaps_according_to_mode (title_bar); -} - -ETitleBarButtonMode -e_title_bar_get_button_mode (ETitleBar *title_bar) -{ - g_return_val_if_fail (title_bar != NULL, E_TITLE_BAR_BUTTON_MODE_CLOSE); - g_return_val_if_fail (E_IS_TITLE_BAR (title_bar), E_TITLE_BAR_BUTTON_MODE_CLOSE); - - return title_bar->priv->button_mode; -} - - -E_MAKE_TYPE (e_title_bar, "ETitleBar", ETitleBar, class_init, init, PARENT_TYPE) diff --git a/widgets/misc/e-title-bar.h b/widgets/misc/e-title-bar.h deleted file mode 100644 index 32c4f2b262..0000000000 --- a/widgets/misc/e-title-bar.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-title-bar.h - * - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_TITLE_BAR_H__ -#define __E_TITLE_BAR_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkframe.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_TITLE_BAR (e_title_bar_get_type ()) -#define E_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TITLE_BAR, ETitleBar)) -#define E_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TITLE_BAR, ETitleBarClass)) -#define E_IS_TITLE_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TITLE_BAR)) -#define E_IS_TITLE_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_TITLE_BAR)) - - -enum _ETitleBarButtonMode { - E_TITLE_BAR_BUTTON_MODE_PIN, - E_TITLE_BAR_BUTTON_MODE_CLOSE -}; -typedef enum _ETitleBarButtonMode ETitleBarButtonMode; - -typedef struct _ETitleBar ETitleBar; -typedef struct _ETitleBarPrivate ETitleBarPrivate; -typedef struct _ETitleBarClass ETitleBarClass; - -struct _ETitleBar { - GtkFrame parent; - - ETitleBarPrivate *priv; -}; - -struct _ETitleBarClass { - GtkFrameClass parent_class; - - /* Signals. */ - - void (* label_button_press_event) (ETitleBar *title_bar, GdkEventButton *event); - void (* button_clicked) (ETitleBar *title_bar); -}; - - -GtkType e_title_bar_get_type (void); -void e_title_bar_construct (ETitleBar *title_bar, - const char *title); -GtkWidget *e_title_bar_new (const char *title); -void e_title_bar_set_title (ETitleBar *title_bar, - const char *title); -void e_title_bar_show_button (ETitleBar *title_bar, - gboolean show); -void e_title_bar_set_button_mode (ETitleBar *title_bar, - ETitleBarButtonMode button_mode); -ETitleBarButtonMode e_title_bar_get_button_mode (ETitleBar *title_bar); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_TITLE_BAR_H__ */ diff --git a/widgets/misc/e-url-entry.c b/widgets/misc/e-url-entry.c index e2f15802f9..e712485585 100644 --- a/widgets/misc/e-url-entry.c +++ b/widgets/misc/e-url-entry.c @@ -94,7 +94,6 @@ init (EUrlEntry *url_entry) { EUrlEntryPrivate *priv; GtkWidget *pixmap; - GdkPixbuf *pixbuf; priv = g_new0 (EUrlEntryPrivate, 1); url_entry->priv = priv; @@ -104,9 +103,7 @@ init (EUrlEntry *url_entry) priv->button = gtk_button_new (); gtk_widget_set_sensitive (priv->button, FALSE); gtk_box_pack_start (GTK_BOX (url_entry), priv->button, FALSE, FALSE, 0); - pixbuf = e_icon_factory_get_icon ("stock_connect-to-url", E_ICON_SIZE_BUTTON); - pixmap = gtk_image_new_from_pixbuf (pixbuf); - g_object_unref (pixbuf); + pixmap = e_icon_factory_get_image ("stock_connect-to-url", E_ICON_SIZE_BUTTON); gtk_container_add (GTK_CONTAINER (priv->button), pixmap); gtk_widget_show (pixmap); diff --git a/widgets/misc/test-title-bar.c b/widgets/misc/test-info-label.c index 80944f5b01..e4b053d81d 100644 --- a/widgets/misc/test-title-bar.c +++ b/widgets/misc/test-info-label.c @@ -31,7 +31,8 @@ #include <libgnomeui/gnome-app.h> #include <libgnomeui/gnome-ui-init.h> -#include "e-title-bar.h" +#include <e-util/e-icon-factory.h> +#include "e-info-label.h" static void delete_event_cb (GtkWidget *widget, @@ -39,17 +40,19 @@ delete_event_cb (GtkWidget *widget, gpointer data) { gtk_main_quit (); + e_icon_factory_shutdown (); } int main (int argc, char **argv) { GtkWidget *app; - GtkWidget *title_bar; + GtkWidget *info_label; GtkWidget *label; GtkWidget *vbox; gnome_init ("test-title-bar", "0.0", argc, argv); + e_icon_factory_init (); app = gnome_app_new ("Test", "Test"); gtk_window_set_default_size (GTK_WINDOW (app), 400, 400); @@ -57,14 +60,15 @@ main (int argc, char **argv) g_signal_connect((app), "delete_event", G_CALLBACK (delete_event_cb), NULL); - title_bar = e_title_bar_new ("This is a very annoyingly long title bar"); - gtk_widget_show (title_bar); + info_label = e_info_label_new ("stock_default-folder"); + e_info_label_set_info ((EInfoLabel *) info_label, "Component Name", "An annoyingly long component message"); + gtk_widget_show (info_label); label = gtk_label_new ("boo"); gtk_widget_show (label); vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), title_bar, FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox), info_label, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); gtk_widget_show (vbox); |