From 4b42dc071e1a8de45d0a11a13df342ed7d0314e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pekka=20Geh=C3=B6r?= Date: Tue, 30 Dec 2008 13:18:44 +0200 Subject: [PATCH] Added _set_new_button_details() functio. This clarity to code. --- irreco/src/core/irreco_button_creator_dlg.c | 69 ++++++++++++++++++----------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/irreco/src/core/irreco_button_creator_dlg.c b/irreco/src/core/irreco_button_creator_dlg.c index 927377fd..19ac406d 100644 --- a/irreco/src/core/irreco_button_creator_dlg.c +++ b/irreco/src/core/irreco_button_creator_dlg.c @@ -91,6 +91,8 @@ void _unbutton_size_changed(GtkSpinButton *spinbutton, IrrecoButtonCreatorDlg*self); void _button_size_changed(GtkSpinButton *spinbutton, IrrecoButtonCreatorDlg*self); +void +_set_new_button_details(IrrecoButtonCreatorDlg *self, IrrecoThemeButton *button); /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Construction & Destruction */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ @@ -651,8 +653,6 @@ gboolean irreco_button_creator_dlg_run(IrrecoData *irreco_data, self->theme = irreco_theme; IRRECO_PRINTF("Button: %s\n", button->name->str); - - /*if(irreco_theme != NULL) {*/ if (g_utf8_strlen(button->name->str, 1) >0) { /* Sets the button details */ _set_button_details(self, irreco_theme, button); @@ -663,31 +663,8 @@ gboolean irreco_button_creator_dlg_run(IrrecoData *irreco_data, switch (response) { case GTK_RESPONSE_OK: + _set_new_button_details(self, button); - - irreco_theme_button_set(button, - gtk_combo_box_get_active_text( - GTK_COMBO_BOX( - self->combobox_name)), - gtk_combo_box_get_active_text( - GTK_COMBO_BOX( - self->combobox_name)), - gtk_toggle_button_get_active( - GTK_TOGGLE_BUTTON( - self->allow_text)), - self->unpressed_path->str, - self->pressed_path->str, - self->unpressed_format, - self->pressed_format, - gtk_spin_button_get_value_as_int( - GTK_SPIN_BUTTON( - self->text_padding)), - gtk_spin_button_get_value( - GTK_SPIN_BUTTON( - self->text_h_align)), - gtk_spin_button_get_value( - GTK_SPIN_BUTTON( - self->text_v_align))); irreco_theme_button_print(button); rvalue = TRUE; loop = FALSE; @@ -759,6 +736,46 @@ _set_button_details(IrrecoButtonCreatorDlg *self, IrrecoTheme *irreco_theme, IRRECO_RETURN } + +void +_set_new_button_details(IrrecoButtonCreatorDlg *self, IrrecoThemeButton *button) +{ + + + gchar *style_name = NULL; + gboolean allow_text = FALSE; + gint text_padding = 0; + gfloat text_h_align = 0; + gfloat text_v_align = 0; + IRRECO_ENTER + + style_name = gtk_combo_box_get_active_text(GTK_COMBO_BOX( + self->combobox_name)); + allow_text = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( + self->allow_text)); + text_padding = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON( + self->text_padding)); + text_h_align = gtk_spin_button_get_value(GTK_SPIN_BUTTON( + self->text_h_align)); + text_v_align = gtk_spin_button_get_value(GTK_SPIN_BUTTON( + self->text_v_align)); + + irreco_theme_button_set(button, + style_name, + style_name, + allow_text, + self->unpressed_path->str, + self->pressed_path->str, + self->unpressed_format, + self->pressed_format, + text_padding, + text_h_align, + text_v_align); + + g_free(style_name); + IRRECO_RETURN + +} /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ /* Events and Callbacks */ /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/ -- 2.11.4.GIT