diff options
author | jstebbins <[email protected]> | 2008-09-25 14:38:21 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2008-09-25 14:38:21 +0000 |
commit | 0a66557bbd0c429e27463d8bb3fe1918e44b344b (patch) | |
tree | 51aa5dbf53bc24f60e021f311f96d9c1a845da97 | |
parent | b6e78bffa6baa8adb7436a9e41a392c4544aacc3 (diff) |
LinGui: Store the activity log in the users config dir instead of PWD.
Display the location of the activity log in the activity window.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1761 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | gtk/src/ghb.ui | 12 | ||||
-rw-r--r-- | gtk/src/main.c | 12 | ||||
-rw-r--r-- | gtk/src/presets.c | 59 | ||||
-rw-r--r-- | gtk/src/presets.h | 1 | ||||
-rw-r--r-- | gtk/src/resource_data.h | 17 | ||||
-rw-r--r-- | gtk/src/resources.plist | 12 | ||||
-rw-r--r-- | gtk/src/settings.c | 4 |
7 files changed, 90 insertions, 27 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 9772e4ac9..18b2a7676 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -3813,6 +3813,16 @@ this setting.</property> <placeholder/> </child> <child> + <object class="GtkLabel" id="activity_location"> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkScrolledWindow" id="activity_scroll"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -3833,7 +3843,7 @@ this setting.</property> </child> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> diff --git a/gtk/src/main.c b/gtk/src/main.c index ed07b5ca3..c03c15032 100644 --- a/gtk/src/main.c +++ b/gtk/src/main.c @@ -385,6 +385,7 @@ IoRedirect(signal_user_data_t *ud) { GIOChannel *channel; gint pfd[2]; + gchar *config, *path; // I'm opening a pipe and attaching the writer end to stderr // The reader end will be polled by main event loop and I'll get @@ -396,7 +397,12 @@ IoRedirect(signal_user_data_t *ud) } // Open activity log. // TODO: Put this in the same directory as the encode destination - ud->activity_log = g_io_channel_new_file ("Activity.log", "w", NULL); + config = ghb_get_user_config_dir(); + path = g_strdup_printf("%s/%s", config, "Activity.log"); + ud->activity_log = g_io_channel_new_file (path, "w", NULL); + ghb_ui_update(ud, "activity_location", ghb_string_value(path)); + g_free(path); + g_free(config); // Set encoding to raw. g_io_channel_set_encoding (ud->activity_log, NULL, NULL); stderr->_fileno = pfd[1]; @@ -492,11 +498,11 @@ main (int argc, char *argv[]) ud->current_job = NULL; ud->current_dvd_device = NULL; ud->dont_clear_presets = FALSE; - // Redirect stderr to the activity window - IoRedirect(ud); // Enable events that alert us to media change events watch_volumes (ud); ud->builder = create_builder_or_die (BUILDER_NAME); + // Redirect stderr to the activity window + IoRedirect(ud); ghb_init_dep_map(); // Need to connect x264_options textview buffer to the changed signal diff --git a/gtk/src/presets.c b/gtk/src/presets.c index e3ec46591..2f7eaa88a 100644 --- a/gtk/src/presets.c +++ b/gtk/src/presets.c @@ -348,23 +348,40 @@ ghb_update_from_preset( } } -static void -store_plist(GValue *plist, const gchar *name) +gchar* +ghb_get_user_config_dir() { const gchar *dir; gchar *config; - FILE *file; dir = g_get_user_config_dir(); - config = g_strdup_printf ("%s/ghb", dir); - if (!g_file_test(config, G_FILE_TEST_IS_DIR)) + if (!g_file_test(dir, G_FILE_TEST_IS_DIR)) { - g_mkdir (config, 0755); + dir = g_get_home_dir(); + config = g_strdup_printf ("%s/.ghb", dir); + if (!g_file_test(config, G_FILE_TEST_IS_DIR)) + g_mkdir (config, 0755); } + else + { + config = g_strdup_printf ("%s/ghb", dir); + if (!g_file_test(config, G_FILE_TEST_IS_DIR)) + g_mkdir (config, 0755); + } + return config; +} + +static void +store_plist(GValue *plist, const gchar *name) +{ + gchar *config, *path; + FILE *file; + + config = ghb_get_user_config_dir(); + path = g_strdup_printf ("%s/%s", config, name); + file = g_fopen(path, "w"); g_free(config); - config = g_strdup_printf ("%s/ghb/%s", dir, name); - file = g_fopen(config, "w"); - g_free(config); + g_free(path); ghb_plist_write(file, plist); fclose(file); } @@ -372,32 +389,32 @@ store_plist(GValue *plist, const gchar *name) static GValue* load_plist(const gchar *name) { - const gchar *dir; - gchar *config; + gchar *config, *path; GValue *plist = NULL; - dir = g_get_user_config_dir(); - config = g_strdup_printf ("%s/ghb/%s", dir, name); - if (g_file_test(config, G_FILE_TEST_IS_REGULAR)) + config = ghb_get_user_config_dir(); + path = g_strdup_printf ("%s/%s", config, name); + if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { - plist = ghb_plist_parse_file(config); + plist = ghb_plist_parse_file(path); } g_free(config); + g_free(path); return plist; } static void remove_plist(const gchar *name) { - const gchar *dir; - gchar *config; + gchar *config, *path; - dir = g_get_user_config_dir(); - config = g_strdup_printf ("%s/ghb/%s", dir, name); - if (g_file_test(config, G_FILE_TEST_IS_REGULAR)) + config = ghb_get_user_config_dir(); + path = g_strdup_printf ("%s/%s", config, name); + if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { - g_unlink(config); + g_unlink(path); } + g_free(path); g_free(config); } diff --git a/gtk/src/presets.h b/gtk/src/presets.h index c8fbc5044..820899bb9 100644 --- a/gtk/src/presets.h +++ b/gtk/src/presets.h @@ -37,5 +37,6 @@ void ghb_set_preset_default(GValue *settings); void ghb_save_queue(GValue *queue); GValue* ghb_load_queue(); void ghb_remove_queue_file(void);; +gchar* ghb_get_user_config_dir(); #endif // _GHB_PRESETS_H_ diff --git a/gtk/src/resource_data.h b/gtk/src/resource_data.h index e86aae47d..d517271d1 100644 --- a/gtk/src/resource_data.h +++ b/gtk/src/resource_data.h @@ -6264,6 +6264,21 @@ " <placeholder/>\n" " </child>\n" " <child>\n" +" <object class="GtkLabel" id="activity_locat" +"ion">\n" +" <property name="justify">GTK_JUSTIFY_LEFT&l" +"t;/property>\n" +" <property name="visible">True</property&" +"gt;\n" +" </object>\n" +" <packing>\n" +" <property name="expand">False</property&" +"gt;\n" +" <property name="position">1</property>" +";\n" +" </packing>\n" +" </child>\n" +" <child>\n" " <object class="GtkScrolledWindow" id="activ" "ity_scroll">\n" " <property name="visible">True</property&" @@ -6301,7 +6316,7 @@ " </child>\n" " </object>\n" " <packing>\n" -" <property name="position">1</property>" +" <property name="position">2</property>" ";\n" " </packing>\n" " </child>\n" diff --git a/gtk/src/resources.plist b/gtk/src/resources.plist index 155ce7210..c32e361f9 100644 --- a/gtk/src/resources.plist +++ b/gtk/src/resources.plist @@ -3818,6 +3818,16 @@ this setting.</property> <placeholder/> </child> <child> + <object class="GtkLabel" id="activity_location"> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="visible">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkScrolledWindow" id="activity_scroll"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -3838,7 +3848,7 @@ this setting.</property> </child> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> diff --git a/gtk/src/settings.c b/gtk/src/settings.c index 36f4d58a1..6a0e9b813 100644 --- a/gtk/src/settings.c +++ b/gtk/src/settings.c @@ -555,6 +555,10 @@ update_widget(GtkWidget *widget, const GValue *value) GTK_TEXT_VIEW(widget)); gtk_text_buffer_set_text (buffer, str, -1); } + else if (type == GTK_TYPE_LABEL) + { + gtk_label_set_text (GTK_LABEL(widget), str); + } else { g_debug("Attempt to set unknown widget type"); |