diff options
| author | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
|---|---|---|
| committer | Markus Engel <markus.engel@tum.de> | 2013-03-29 23:52:42 +0000 |
| commit | a168040d5a452544328a1e6ad35aaac351f94d44 (patch) | |
| tree | fae1ba829f543a473da281bd5fa6e4deabbf6912 /src/ege-adjustment-action.cpp | |
| parent | Removed function pointers from SPObject and subclasses. (diff) | |
| parent | Dutch translation update (diff) | |
| download | inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.tar.gz inkscape-a168040d5a452544328a1e6ad35aaac351f94d44.zip | |
merged from trunk
(bzr r11608.1.56)
Diffstat (limited to 'src/ege-adjustment-action.cpp')
| -rw-r--r-- | src/ege-adjustment-action.cpp | 59 |
1 files changed, 10 insertions, 49 deletions
diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp index 7881498b9..5a827096f 100644 --- a/src/ege-adjustment-action.cpp +++ b/src/ege-adjustment-action.cpp @@ -47,10 +47,9 @@ #include "icon-size.h" #include "ege-adjustment-action.h" +#include "ui/widget/gimpspinscale.h" -static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ); -static void ege_adjustment_action_init( EgeAdjustmentAction* action ); static void ege_adjustment_action_finalize( GObject* object ); static void ege_adjustment_action_get_property( GObject* obj, guint propId, GValue* value, GParamSpec * pspec ); static void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValue *value, GParamSpec* pspec ); @@ -69,8 +68,6 @@ static void ege_adjustment_action_defocus( EgeAdjustmentAction* action ); static void egeAct_free_description( gpointer data, gpointer user_data ); static void egeAct_free_all_descriptions( EgeAdjustmentAction* action ); - -static GtkActionClass* gParentClass = 0; static EgeCreateAdjWidgetCB gFactoryCb = 0; static GQuark gDataName = 0; @@ -145,34 +142,11 @@ enum { BUMP_CUSTOM = 100 }; -GType ege_adjustment_action_get_type( void ) -{ - static GType myType = 0; - if ( !myType ) { - static const GTypeInfo myInfo = { - sizeof( EgeAdjustmentActionClass ), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)ege_adjustment_action_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof( EgeAdjustmentAction ), - 0, /* n_preallocs */ - (GInstanceInitFunc)ege_adjustment_action_init, - NULL - }; - - myType = g_type_register_static( GTK_TYPE_ACTION, "EgeAdjustmentAction", &myInfo, (GTypeFlags)0 ); - } - - return myType; -} - +G_DEFINE_TYPE(EgeAdjustmentAction, ege_adjustment_action, GTK_TYPE_ACTION); static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass ) { if ( klass ) { - gParentClass = GTK_ACTION_CLASS( g_type_class_peek_parent( klass ) ); GObjectClass * objClass = G_OBJECT_CLASS( klass ); gDataName = g_quark_from_string("ege-adj-action"); @@ -307,8 +281,8 @@ static void ege_adjustment_action_finalize( GObject* object ) egeAct_free_all_descriptions( action ); - if ( G_OBJECT_CLASS(gParentClass)->finalize ) { - (*G_OBJECT_CLASS(gParentClass)->finalize)(object); + if ( G_OBJECT_CLASS(ege_adjustment_action_parent_class)->finalize ) { + (*G_OBJECT_CLASS(ege_adjustment_action_parent_class)->finalize)(object); } } @@ -771,13 +745,13 @@ static GtkWidget* create_menu_item( GtkAction* action ) gtk_widget_show_all( subby ); g_value_unset( &value ); } else { - item = gParentClass->create_menu_item( action ); + item = GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->create_menu_item( action ); } return item; } -void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) +static void value_changed_cb( GtkSpinButton* spin, EgeAdjustmentAction* act ) { if ( gtk_widget_has_focus( GTK_WIDGET(spin) ) ) { gint start = 0, end = 0; @@ -809,12 +783,6 @@ static gboolean event_cb( EgeAdjustmentAction* act, GdkEvent* evt ) return handled; } -static gchar *slider_format_falue( GtkScale* scale, gdouble value, gchar *label ) -{ - (void)scale; - return g_strdup_printf("%s %d", label, (int) round(value)); -} - static GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget* item = 0; @@ -835,15 +803,8 @@ static GtkWidget* create_tool_item( GtkAction* action ) if ( act->private_data->appearanceMode == APPEARANCE_FULL ) { /* Slider */ - gchar *leakyForNow = g_value_dup_string( &value ); -#if GTK_CHECK_VERSION(3,0,0) - spinbutton = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, act->private_data->adj); -#else - spinbutton = gtk_hscale_new( act->private_data->adj); -#endif + spinbutton = gimp_spin_scale_new (act->private_data->adj, g_value_get_string( &value ), 0); gtk_widget_set_size_request(spinbutton, 100, -1); - gtk_scale_set_digits( GTK_SCALE(spinbutton), 0 ); - g_signal_connect( G_OBJECT(spinbutton), "format-value", G_CALLBACK(slider_format_falue), leakyForNow ); } else if ( act->private_data->appearanceMode == APPEARANCE_MINIMAL ) { spinbutton = gtk_scale_button_new( GTK_ICON_SIZE_MENU, 0, 100, 2, 0 ); @@ -922,7 +883,7 @@ static GtkWidget* create_tool_item( GtkAction* action ) g_value_unset( &value ); } else { - item = gParentClass->create_tool_item( action ); + item = GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->create_tool_item( action ); } return item; @@ -930,12 +891,12 @@ static GtkWidget* create_tool_item( GtkAction* action ) static void connect_proxy( GtkAction *action, GtkWidget *proxy ) { - gParentClass->connect_proxy( action, proxy ); + GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->connect_proxy( action, proxy ); } static void disconnect_proxy( GtkAction *action, GtkWidget *proxy ) { - gParentClass->disconnect_proxy( action, proxy ); + GTK_ACTION_CLASS(ege_adjustment_action_parent_class)->disconnect_proxy( action, proxy ); } void ege_adjustment_action_defocus( EgeAdjustmentAction* action ) |
