]> granicus.if.org Git - handbrake/commitdiff
LinGui: Store the activity log in the users config dir instead of PWD.
authorjstebbins <jstebbins.hb@gmail.com>
Thu, 25 Sep 2008 14:38:21 +0000 (14:38 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Thu, 25 Sep 2008 14:38:21 +0000 (14:38 +0000)
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

gtk/src/ghb.ui
gtk/src/main.c
gtk/src/presets.c
gtk/src/presets.h
gtk/src/resource_data.h
gtk/src/resources.plist
gtk/src/settings.c

index 9772e4ac99ffcffddf4e0959985f4cd04cc03f21..18b2a767646a2e76bac0bde688d1dc678951d822 100644 (file)
@@ -3812,6 +3812,16 @@ this setting.</property>
         <child>
           <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>
@@ -3833,7 +3843,7 @@ this setting.</property>
             </child>
           </object>
           <packing>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
index ed07b5ca3ef9648e34a86a21271969ec989f6048..c03c150323335bf366f0108859eca385b15a72e9 100644 (file)
@@ -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
index e3ec465911c03a5c31a7a63b92db9bd5d57696e3..2f7eaa88a30a7ae36cdafc96d7851070b8001c84 100644 (file)
@@ -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);
 }
 
index c8fbc50448f3ff9add5f8ca907db2a72d58d38de..820899bb90bb55c6a26d1d9fc02c4928b2ccde9a 100644 (file)
@@ -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_
index e86aae47d2eebf1c86f026a5f12f73f76a256d83..d517271d1fb51d609e043043737e4a73e537ce6f 100644 (file)
 "          &lt;placeholder/&gt;\n"
 "        &lt;/child&gt;\n"
 "        &lt;child&gt;\n"
+"          &lt;object class=&quot;GtkLabel&quot; id=&quot;activity_locat"
+"ion&quot;&gt;\n"
+"            &lt;property name=&quot;justify&quot;&gt;GTK_JUSTIFY_LEFT&l"
+"t;/property&gt;\n"
+"            &lt;property name=&quot;visible&quot;&gt;True&lt;/property&"
+"gt;\n"
+"          &lt;/object&gt;\n"
+"          &lt;packing&gt;\n"
+"            &lt;property name=&quot;expand&quot;&gt;False&lt;/property&"
+"gt;\n"
+"            &lt;property name=&quot;position&quot;&gt;1&lt;/property&gt"
+";\n"
+"          &lt;/packing&gt;\n"
+"        &lt;/child&gt;\n"
+"        &lt;child&gt;\n"
 "          &lt;object class=&quot;GtkScrolledWindow&quot; id=&quot;activ"
 "ity_scroll&quot;&gt;\n"
 "            &lt;property name=&quot;visible&quot;&gt;True&lt;/property&"
 "            &lt;/child&gt;\n"
 "          &lt;/object&gt;\n"
 "          &lt;packing&gt;\n"
-"            &lt;property name=&quot;position&quot;&gt;1&lt;/property&gt"
+"            &lt;property name=&quot;position&quot;&gt;2&lt;/property&gt"
 ";\n"
 "          &lt;/packing&gt;\n"
 "        &lt;/child&gt;\n"
index 155ce72101cdcacaaf2642cd6016c8bc28ff42e6..c32e361f9c8ee6ba0a381d0c227a7a8548165ec2 100644 (file)
@@ -3817,6 +3817,16 @@ this setting.&lt;/property&gt;
         &lt;child&gt;
           &lt;placeholder/&gt;
         &lt;/child&gt;
+        &lt;child&gt;
+          &lt;object class=&quot;GtkLabel&quot; id=&quot;activity_location&quot;&gt;
+            &lt;property name=&quot;justify&quot;&gt;GTK_JUSTIFY_LEFT&lt;/property&gt;
+            &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
+          &lt;/object&gt;
+          &lt;packing&gt;
+            &lt;property name=&quot;expand&quot;&gt;False&lt;/property&gt;
+            &lt;property name=&quot;position&quot;&gt;1&lt;/property&gt;
+          &lt;/packing&gt;
+        &lt;/child&gt;
         &lt;child&gt;
           &lt;object class=&quot;GtkScrolledWindow&quot; id=&quot;activity_scroll&quot;&gt;
             &lt;property name=&quot;visible&quot;&gt;True&lt;/property&gt;
@@ -3838,7 +3848,7 @@ this setting.&lt;/property&gt;
             &lt;/child&gt;
           &lt;/object&gt;
           &lt;packing&gt;
-            &lt;property name=&quot;position&quot;&gt;1&lt;/property&gt;
+            &lt;property name=&quot;position&quot;&gt;2&lt;/property&gt;
           &lt;/packing&gt;
         &lt;/child&gt;
         &lt;child&gt;
index 36f4d58a165ed45126b6e16c4f117700e32af547..6a0e9b8132d20eeb759d674456b4405be27ea13d 100644 (file)
@@ -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");