[Thoggen-cvs] thoggen/src th-app-window.c,1.5,1.6 th-job-config-dialog.c,1.19,1.20
Status: Beta
Brought to you by:
tp-m
From: Tim M. <tp...@us...> - 2005-10-10 17:21:10
|
Update of /cvsroot/thoggen/thoggen/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17130/src Modified Files: th-app-window.c th-job-config-dialog.c Log Message: * src/th-app-window.c: (app_window_set_property), (app_window_get_property), (app_window_class_init), (appwin_setup_preferences), (app_window_instance_init), (app_window_finalize): * src/th-job-config-dialog.c: (job_config_dialog_run_filechooser): * NEWS: Remember last output directory used and make that the current directory when popping up the SaveAs dialog (still needs to improved, but at least it's a start). Index: th-app-window.c =================================================================== RCS file: /cvsroot/thoggen/thoggen/src/th-app-window.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** th-app-window.c 16 Mar 2005 19:11:43 -0000 1.5 --- th-app-window.c 10 Oct 2005 17:21:09 -0000 1.6 *************** *** 36,40 **** enum { ! PROP_CANCEL = 1 }; --- 36,40 ---- enum { ! PROP_LAST_OUTPUT_DIRECTORY = 1 }; *************** *** 56,59 **** --- 56,61 ---- GList *fake_dialogs; + + gchar *last_output_dir; }; *************** *** 169,172 **** --- 171,239 ---- /*************************************************************************** * + * app_window_set_property + * + ***************************************************************************/ + + static void + app_window_set_property (GObject *object, + guint param_id, + const GValue *value, + GParamSpec *pspec) + { + ThAppWindow *appwin = (ThAppWindow*) object; + + g_return_if_fail (TH_IS_APP_WINDOW (appwin)); + + switch (param_id) + { + case PROP_LAST_OUTPUT_DIRECTORY: + g_free (appwin->priv->last_output_dir); + appwin->priv->last_output_dir = g_value_dup_string (value); + if (!appwin->priv->last_output_dir + || !g_file_test (appwin->priv->last_output_dir, G_FILE_TEST_IS_DIR)) + { + g_warning ("NOT A DIRECTORY (%s), SETTING LAST-OUTPUT-DIR to %s!\n", + appwin->priv->last_output_dir, g_get_home_dir ()); + g_free (appwin->priv->last_output_dir); + appwin->priv->last_output_dir = g_strdup (g_get_home_dir ()); + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + break; + } + } + + /*************************************************************************** + * + * app_window_get_property + * + ***************************************************************************/ + + static void + app_window_get_property (GObject *object, + guint param_id, + GValue *value, + GParamSpec *pspec) + { + ThAppWindow *appwin = (ThAppWindow*) object; + + g_return_if_fail (TH_IS_APP_WINDOW (appwin)); + + switch (param_id) + { + case PROP_LAST_OUTPUT_DIRECTORY: + g_value_set_string (value, appwin->priv->last_output_dir); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + break; + } + } + + /*************************************************************************** + * * app_window_class_init * *************** *** 183,186 **** --- 250,262 ---- object_class->finalize = app_window_finalize; + object_class->set_property = app_window_set_property; + object_class->get_property = app_window_get_property; + + g_object_class_install_property (object_class, PROP_LAST_OUTPUT_DIRECTORY, + g_param_spec_string ("last-output-directory", + "last-output-directory", + "last-output-directory", + NULL, + G_PARAM_READWRITE)); } *************** *** 259,262 **** --- 335,344 ---- NULL); + th_preferences_register_proxy (appwin->priv->prefs, + G_OBJECT (appwin), + "last-output-directory", + "last-output-directory", + NULL); + th_preferences_load (appwin->priv->prefs); } *************** *** 326,329 **** --- 408,413 ---- gtk_widget_show_all (GTK_WIDGET (appwin)); + appwin->priv->last_output_dir = g_strdup (g_get_home_dir()); + appwin_setup_preferences (appwin); *************** *** 351,354 **** --- 435,440 ---- appwin->priv->fake_dialogs = NULL; + g_free (appwin->priv->last_output_dir); + memset (appwin->priv, 0xab, sizeof (ThAppWindowPrivate)); g_free (appwin->priv); Index: th-job-config-dialog.c =================================================================== RCS file: /cvsroot/thoggen/thoggen/src/th-job-config-dialog.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** th-job-config-dialog.c 17 Mar 2005 15:43:21 -0000 1.19 --- th-job-config-dialog.c 10 Oct 2005 17:21:09 -0000 1.20 *************** *** 268,280 **** g_free (basename); } if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT) { ! gchar *fn; fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fc)); g_object_set (jcd->priv->job, "output-fn", fn, NULL); ! g_free (fn); } --- 268,296 ---- g_free (basename); } + + { + gchar *last_output_dir; + + g_object_get (appwin, "last-output-directory", &last_output_dir, NULL); + + if (last_output_dir) + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (fc), last_output_dir); + + g_free (last_output_dir); + } if (gtk_dialog_run (GTK_DIALOG (fc)) == GTK_RESPONSE_ACCEPT) { ! gchar *fn, *dir; fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fc)); g_object_set (jcd->priv->job, "output-fn", fn, NULL); ! ! dir = g_path_get_dirname (fn); ! ! g_object_set (appwin, "last-output-directory", dir, NULL); ! ! g_free (dir); g_free (fn); } |