diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-02-26 22:26:42 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-02-26 22:26:42 +0000 |
commit | 570722dab305bcd5b833b9f76a1b4399c14f3b07 (patch) | |
tree | 013c0fc27dc8a14ef4cc66d00a2d0e1b82b22d97 /gtk | |
parent | adfda29e38f72143508d9ce9f39502500d509d1e (diff) |
Remember the last used profile and restore this on startup.
svn path=/trunk/; revision=27560
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main.c | 23 | ||||
-rw-r--r-- | gtk/recent.c | 8 |
2 files changed, 21 insertions, 10 deletions
diff --git a/gtk/main.c b/gtk/main.c index 1b7472fdd3..a3f6345333 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -739,8 +739,8 @@ void expand_tree_cb(GtkWidget *widget _U_, gpointer data _U_) { path = tree_find_by_field_info(GTK_TREE_VIEW(tree_view), cfile.finfo_selected); if(path) { /* the mouse position is at an entry, expand that one */ - gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); - gtk_tree_path_free(path); + gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_view), path, TRUE); + gtk_tree_path_free(path); } } @@ -1889,6 +1889,14 @@ main(int argc, char *argv[]) runtime_info_str = g_string_new("Running "); get_runtime_version_info(runtime_info_str, get_gui_runtime_info); + /* Read the profile independent recent file. We have to do this here so we can */ + /* set the profile before it can be set from the command line parameterts */ + recent_read_static(&rf_path, &rf_open_errno); + if (rf_path != NULL && rf_open_errno != 0) { + simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, + "Could not open common recent file\n\"%s\": %s.", + rf_path, strerror(rf_open_errno)); + } /* "pre-scan" the command line parameters, if we have "console only" parameters. We do this so we don't start GTK+ if we're only showing @@ -2115,15 +2123,10 @@ main(int argc, char *argv[]) splash_update(RA_CONFIGURATION, NULL, (gpointer)splash_win); - /* Read the (static part) of the recent file. Only the static part of it will be read, */ - /* as we don't have the gui now to fill the recent lists which is done in the dynamic part. */ + /* Read the profile dependent (static part) of the recent file. */ + /* Only the static part of it will be read, as we don't have the gui now to fill the */ + /* recent lists which is done in the dynamic part. */ /* We have to do this already here, so command line parameters can overwrite these values. */ - recent_read_static(&rf_path, &rf_open_errno); - if (rf_path != NULL && rf_open_errno != 0) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open common recent file\n\"%s\": %s.", - rf_path, strerror(rf_open_errno)); - } recent_read_profile_static(&rf_path, &rf_open_errno); if (rf_path != NULL && rf_open_errno != 0) { simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, diff --git a/gtk/recent.c b/gtk/recent.c index ec0c181044..51642c8f5a 100644 --- a/gtk/recent.c +++ b/gtk/recent.c @@ -77,6 +77,7 @@ #define RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT "gui.geometry_status_pane" #define RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT "gui.geometry_status_pane_right" #define RECENT_GUI_GEOMETRY_WLAN_STATS_PANE "gui.geometry_status_wlan_stats_pane" +#define RECENT_LAST_USED_PROFILE "gui.last_used_profile" #define RECENT_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen_remembered_dir" #define RECENT_GUI_GEOMETRY "gui.geom." #define RECENT_KEY_PRIVS_WARN_IF_ELEVATED "privs.warn_if_elevated" @@ -222,6 +223,9 @@ write_recent(void) recent.gui_geometry_status_pane_right); } + fprintf(rf, "\n# Last used Configuration Profile.\n"); + fprintf(rf, RECENT_LAST_USED_PROFILE ": %s\n", get_profile_name()); + fprintf(rf, "\n# WLAN statistics upper pane size.\n"); fprintf(rf, "# Decimal number.\n"); fprintf(rf, RECENT_GUI_GEOMETRY_WLAN_STATS_PANE ": %d\n", @@ -468,6 +472,10 @@ read_set_recent_common_pair_static(gchar *key, gchar *value, void *private_data return PREFS_SET_SYNTAX_ERR; /* number must be positive */ recent.gui_geometry_status_pane_left = num; recent.has_gui_geometry_status_pane = TRUE; + } else if (strcmp(key, RECENT_LAST_USED_PROFILE) == 0) { + if ((strcmp(value, DEFAULT_PROFILE) != 0) && profile_exists (value)) { + set_profile_name (value); + } } else if (strcmp(key, RECENT_GUI_GEOMETRY_WLAN_STATS_PANE) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') |