[gnome-commander] Use G_DEFINE_TYPE for GnomeCmdPatternselDialog
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Use G_DEFINE_TYPE for GnomeCmdPatternselDialog
- Date: Wed, 4 May 2011 16:21:37 +0000 (UTC)
commit d6f6d04d857955bfda27f672e4a908f9ecd955e8
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Wed May 4 18:20:04 2011 +0200
Use G_DEFINE_TYPE for GnomeCmdPatternselDialog
src/gnome-cmd-patternsel-dialog.cc | 86 +++++++++++-------------------------
1 files changed, 26 insertions(+), 60 deletions(-)
---
diff --git a/src/gnome-cmd-patternsel-dialog.cc b/src/gnome-cmd-patternsel-dialog.cc
index ff3e311..49871e0 100644
--- a/src/gnome-cmd-patternsel-dialog.cc
+++ b/src/gnome-cmd-patternsel-dialog.cc
@@ -41,7 +41,7 @@ struct GnomeCmdPatternselDialogPrivate
};
-static GnomeCmdDialogClass *parent_class = NULL;
+G_DEFINE_TYPE (GnomeCmdPatternselDialog, gnome_cmd_patternsel_dialog, GNOME_CMD_TYPE_DIALOG)
static void on_ok (GtkButton *button, GnomeCmdPatternselDialog *dialog)
@@ -72,7 +72,7 @@ static void on_cancel (GtkButton *button, GnomeCmdPatternselDialog *dialog)
* Gtk class implementation
*******************************/
-static void destroy (GtkObject *object)
+static void gnome_cmd_patternsel_dialog_finalize (GObject *object)
{
GnomeCmdPatternselDialog *dialog = GNOME_CMD_PATTERNSEL_DIALOG (object);
@@ -80,49 +80,16 @@ static void destroy (GtkObject *object)
g_free (dialog->priv);
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ G_OBJECT_CLASS (gnome_cmd_patternsel_dialog_parent_class)->finalize (object);
}
-static void map (GtkWidget *widget)
+static void gnome_cmd_patternsel_dialog_init (GnomeCmdPatternselDialog *dialog)
{
- if (GTK_WIDGET_CLASS (parent_class)->map != NULL)
- GTK_WIDGET_CLASS (parent_class)->map (widget);
-}
-
-
-static void class_init (GnomeCmdPatternselDialogClass *klass)
-{
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = (GnomeCmdDialogClass *) gtk_type_class (GNOME_CMD_TYPE_DIALOG);
- object_class->destroy = destroy;
- widget_class->map = ::map;
-}
-
-
-static void init (GnomeCmdPatternselDialog *dialog)
-{
- dialog->priv = g_new0 (GnomeCmdPatternselDialogPrivate, 1);
-}
-
-
-/***********************************
- * Public functions
- ***********************************/
-
-GtkWidget *gnome_cmd_patternsel_dialog_new (GnomeCmdFileList *fl, gboolean mode)
-{
- GtkWidget *hbox, *vbox, *label, *radio;
GnomeCmdData::SearchConfig &defaults = gnome_cmd_data.search_defaults;
- GnomeCmdPatternselDialog *dialog = (GnomeCmdPatternselDialog *) g_object_new (GNOME_CMD_TYPE_PATTERNSEL_DIALOG, NULL);
-
- dialog->priv->mode = mode;
- dialog->priv->fl = fl;
+ GtkWidget *hbox, *vbox, *label, *radio;
- gnome_cmd_dialog_setup ( GNOME_CMD_DIALOG (dialog), mode ? _("Select Using Pattern") : _("Unselect Using Pattern"));
+ dialog->priv = g_new0 (GnomeCmdPatternselDialogPrivate, 1);
gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_SIGNAL_FUNC (on_cancel), dialog);
gnome_cmd_dialog_add_button (GNOME_CMD_DIALOG (dialog), GTK_STOCK_OK, GTK_SIGNAL_FUNC (on_ok), dialog);
@@ -162,30 +129,29 @@ GtkWidget *gnome_cmd_patternsel_dialog_new (GnomeCmdFileList *fl, gboolean mode)
gnome_cmd_dialog_add_category (GNOME_CMD_DIALOG (dialog), vbox);
gtk_widget_grab_focus (dialog->priv->pattern_entry);
+}
- return GTK_WIDGET (dialog);
+
+static void gnome_cmd_patternsel_dialog_class_init (GnomeCmdPatternselDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gnome_cmd_patternsel_dialog_finalize;
}
-GtkType gnome_cmd_patternsel_dialog_get_type ()
+/***********************************
+ * Public functions
+ ***********************************/
+
+GtkWidget *gnome_cmd_patternsel_dialog_new (GnomeCmdFileList *fl, gboolean mode)
{
- static GtkType dlg_type = 0;
-
- if (dlg_type == 0)
- {
- GtkTypeInfo dlg_info =
- {
- "GnomeCmdPatternselDialog",
- sizeof (GnomeCmdPatternselDialog),
- sizeof (GnomeCmdPatternselDialogClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL
- };
-
- dlg_type = gtk_type_unique (GNOME_CMD_TYPE_DIALOG, &dlg_info);
- }
- return dlg_type;
+ GnomeCmdPatternselDialog *dialog = (GnomeCmdPatternselDialog *) g_object_new (GNOME_CMD_TYPE_PATTERNSEL_DIALOG, NULL);
+
+ dialog->priv->mode = mode;
+ dialog->priv->fl = fl;
+
+ gnome_cmd_dialog_setup (GNOME_CMD_DIALOG (dialog), mode ? _("Select Using Pattern") : _("Unselect Using Pattern"));
+
+ return GTK_WIDGET (dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]