summaryrefslogtreecommitdiffstats
path: root/src/widgets/button.cpp
diff options
context:
space:
mode:
authorMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
committerMarkus Engel <markus.engel@tum.de>2013-03-29 23:52:42 +0000
commita168040d5a452544328a1e6ad35aaac351f94d44 (patch)
treefae1ba829f543a473da281bd5fa6e4deabbf6912 /src/widgets/button.cpp
parentRemoved function pointers from SPObject and subclasses. (diff)
parentDutch translation update (diff)
downloadinkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz
inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/widgets/button.cpp')
-rw-r--r--src/widgets/button.cpp59
1 files changed, 21 insertions, 38 deletions
diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp
index 45356601b..467f0d70e 100644
--- a/src/widgets/button.cpp
+++ b/src/widgets/button.cpp
@@ -25,8 +25,6 @@
#include "button.h"
-static void sp_button_class_init (SPButtonClass *klass);
-static void sp_button_init (SPButton *button);
static void sp_button_dispose(GObject *object);
#if GTK_CHECK_VERSION(3,0,0)
@@ -50,37 +48,14 @@ static void sp_button_set_doubleclick_action (SPButton *button, SPAction *action
static void sp_button_action_set_active (SPButton *button, bool active);
static void sp_button_set_composed_tooltip (GtkWidget *widget, SPAction *action);
-static GtkToggleButtonClass *parent_class;
-
-GType sp_button_get_type(void)
-{
- static GType type = 0;
- if (!type) {
- GTypeInfo info = {
- sizeof(SPButtonClass),
- 0, // base_init
- 0, // base_finalize
- (GClassInitFunc)sp_button_class_init,
- 0, // class_finalize
- 0, // class_data
- sizeof(SPButton),
- 0, // n_preallocs
- (GInstanceInitFunc)sp_button_init,
- 0 // value_table
- };
- type = g_type_register_static(GTK_TYPE_TOGGLE_BUTTON, "SPButton", &info, static_cast<GTypeFlags>(0));
- }
- return type;
-}
+G_DEFINE_TYPE(SPButton, sp_button, GTK_TYPE_TOGGLE_BUTTON);
static void
sp_button_class_init (SPButtonClass *klass)
{
- GObjectClass *object_class=(GObjectClass *)klass;
- GtkWidgetClass *widget_class=(GtkWidgetClass *)klass;
- GtkButtonClass *button_class=(GtkButtonClass *)klass;
-
- parent_class = (GtkToggleButtonClass *)g_type_class_peek_parent (klass);
+ GObjectClass *object_class=G_OBJECT_CLASS(klass);
+ GtkWidgetClass *widget_class=GTK_WIDGET_CLASS(klass);
+ GtkButtonClass *button_class=GTK_BUTTON_CLASS(klass);
object_class->dispose = sp_button_dispose;
#if GTK_CHECK_VERSION(3,0,0)
@@ -120,10 +95,10 @@ static void sp_button_dispose(GObject *object)
sp_button_set_doubleclick_action (button, NULL);
}
- button->c_set_active.~connection();
- button->c_set_sensitive.~connection();
+ button->c_set_active.~connection();
+ button->c_set_sensitive.~connection();
- ((GObjectClass *) (parent_class))->dispose(object);
+ (G_OBJECT_CLASS(sp_button_parent_class))->dispose(object);
}
@@ -185,7 +160,7 @@ sp_button_clicked (GtkButton *button)
SPButton *sp_button=SP_BUTTON (button);
if (sp_button->type == SP_BUTTON_TYPE_TOGGLE) {
- ((GtkButtonClass *) (parent_class))->clicked (button);
+ (GTK_BUTTON_CLASS(sp_button_parent_class))->clicked (button);
}
}
@@ -218,9 +193,7 @@ sp_button_perform_action (SPButton *button, gpointer /*data*/)
GtkWidget *
sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPAction *doubleclick_action )
{
- SPButton *button;
-
- button = (SPButton *)g_object_new (SP_TYPE_BUTTON, NULL);
+ SPButton *button = SP_BUTTON(g_object_new(SP_TYPE_BUTTON, NULL));
button->type = type;
button->lsize = CLAMP( size, Inkscape::ICON_SIZE_MENU, Inkscape::ICON_SIZE_DECORATION );
@@ -232,7 +205,7 @@ sp_button_new( Inkscape::IconSize size, SPButtonType type, SPAction *action, SPA
// The Inkscape style is no-relief buttons
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
- return (GtkWidget *) button;
+ return GTK_WIDGET(button);
}
void
@@ -289,7 +262,7 @@ sp_button_set_action (SPButton *button, SPAction *action)
}
}
- sp_button_set_composed_tooltip ((GtkWidget *) button, action);
+ sp_button_set_composed_tooltip(GTK_WIDGET(button), action);
}
static void
@@ -342,3 +315,13 @@ sp_button_new_from_data( Inkscape::IconSize size,
return button;
}
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :