[gnac/devel] Code cleanup
- From: BenoÃt Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Code cleanup
- Date: Sun, 30 Oct 2011 10:11:26 +0000 (UTC)
commit 0958ba83949dc35042a015606ffb11eccd165412
Author: BenoÃt Dupasquier <bdupasqu src gnome org>
Date: Sun Oct 30 10:11:15 2011 +0000
Code cleanup
src/gnac-prefs.c | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/src/gnac-prefs.c b/src/gnac-prefs.c
index 92b6a1d..687cf6f 100644
--- a/src/gnac-prefs.c
+++ b/src/gnac-prefs.c
@@ -215,27 +215,23 @@ gnac_prefs_set_selected_mode(void)
static void
gnac_prefs_retrieve_settings(void)
{
- gchar *str;
- gint folder_type;
- GtkWidget *temp;
+ gchar *str;
- /* output folder */
- folder_type = g_settings_get_int(settings, GNAC_KEY_FOLDER_TYPE);
- /* output filename combo */
gnac_prefs_set_combo_box_active("output_filename_combo",
g_settings_get_int(settings, GNAC_KEY_RENAME_PATTERN));
- /* output filename entry */
+
str = gnac_prefs_get_rename_pattern_as_str();
gnac_prefs_entry_set_text("output_filename_entry", str);
g_free(str);
- /* folder hierarchy combo */
+
gnac_prefs_set_combo_box_active("folder_hierarchy_combo",
g_settings_get_int(settings, GNAC_KEY_FOLDER_HIERARCHY));
- /* folder hierarchy entry */
+
str = gnac_prefs_get_folder_hierarchy_as_str();
gnac_prefs_entry_set_text("folder_hierarchy_entry", str);
g_free(str);
- switch (folder_type)
+
+ switch (g_settings_get_int(settings, GNAC_KEY_FOLDER_TYPE))
{
case FOLDER_SUBDIRECTORY:
str = g_settings_get_string(settings, GNAC_KEY_DESTINATION_DIRECTORY);
@@ -246,9 +242,9 @@ gnac_prefs_retrieve_settings(void)
break;
case FOLDER_SELECTED:
- temp = gnac_prefs_get_widget("filechooserbutton");
str = g_settings_get_string(settings, GNAC_KEY_DESTINATION_DIRECTORY);
- gtk_file_chooser_select_uri(GTK_FILE_CHOOSER(temp), str);
+ gtk_file_chooser_select_uri(
+ GTK_FILE_CHOOSER(gnac_prefs_get_widget("filechooserbutton")), str);
g_free(str);
gnac_prefs_set_toggle_button_active("selected_radiobutton", TRUE);
gnac_prefs_set_selected_mode();
@@ -323,6 +319,7 @@ gnac_prefs_get_rename_pattern_as_str(void)
{
return g_settings_get_string(settings, GNAC_KEY_RENAME_PATTERN_PATTERN);
}
+
return g_strdup(rename_pattern_default[index]);
}
@@ -339,6 +336,7 @@ gnac_prefs_get_folder_hierarchy_as_str(void)
{
return g_settings_get_string(settings, GNAC_KEY_FOLDER_HIERARCHY_PATTERN);
}
+
return g_strdup(folder_hierarchy_default[index]);
}
@@ -473,9 +471,7 @@ gnac_prefs_button_press_event_cb(GtkWidget *widget,
if (widget_type == GTK_TYPE_COMBO_BOX)
{
- gint size;
- size = gnac_utils_get_combo_size(GTK_COMBO_BOX(widget));
- gtk_combo_box_set_active(GTK_COMBO_BOX(widget), size-1);
+ gnac_prefs_select_custom_pattern(GTK_COMBO_BOX(widget));
}
else if (widget_type == GTK_TYPE_RADIO_BUTTON)
{
@@ -499,6 +495,14 @@ gnac_prefs_custom_pattern_is_selected(GtkComboBox *combo_box,
}
+static void
+gnac_prefs_select_custom_pattern(GtkComboBox *combo_box)
+{
+ gint size = gnac_utils_get_combo_size(combo_box);
+ gtk_combo_box_set_active(combo_box, size-1);
+}
+
+
void
gnac_prefs_pattern_changed_cb(GtkWidget *widget,
gpointer data)
@@ -593,7 +597,7 @@ gnac_on_close_prefs(GtkWidget *widget,
void
gnac_prefs_destroy(void)
{
- GtkWidget *window = NULL;
+ GtkWidget *window;
if (gnac_prefs_builder) {
window = gnac_prefs_get_widget("gnac_preference_window");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]