[gimp] app: Don't crash when the toolbox dock window don't have docks
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Don't crash when the toolbox dock window don't have docks
- Date: Sun, 31 Jan 2010 18:03:37 +0000 (UTC)
commit bf92270051accdddb19f743b917924915eea91cc
Author: Martin Nordholts <martinn src gnome org>
Date: Sun Jan 31 18:54:19 2010 +0100
app: Don't crash when the toolbox dock window don't have docks
Session files from GIMP 2.6 don't need to have docks in the toolbox
top-level. Don't crash on that, instead add a "gimp-toolbox" dock
during sessionrc parsing.
app/widgets/gimpsessioninfo.c | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 3a736ab..f1b2b7e 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -339,6 +339,16 @@ gimp_session_info_deserialize (GimpConfig *config,
error:
+ /* If we don't have docks, assume it is a toolbox dock window from a
+ * sessionrc file from GIMP <= 2.6 and add a toolbox dock manually
+ */
+ if (! info->p->docks)
+ {
+ info->p->docks =
+ g_list_append (info->p->docks,
+ gimp_session_info_dock_new ("gimp-toolbox"));
+ }
+
g_scanner_scope_remove_symbol (scanner, scope_id, "position");
g_scanner_scope_remove_symbol (scanner, scope_id, "size");
g_scanner_scope_remove_symbol (scanner, scope_id, "open-on-exit");
@@ -388,6 +398,7 @@ gimp_session_info_restore (GimpSessionInfo *info,
GtkWidget *dialog = NULL;
GdkDisplay *display = NULL;
GdkScreen *screen = NULL;
+ GList *iter = NULL;
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
@@ -419,26 +430,15 @@ gimp_session_info_restore (GimpSessionInfo *info,
gimp_session_info_aux_set_list (dialog, info->p->aux_info);
}
- /* If we have docks, proceed as usual. If we don't have docks,
- * assume it is the toolbox and restore the dock anyway
+ /* We expect expect there to always be docks. In sessionrc files
+ * from <= 2.6 not all dock window entries had dock entries, but we
+ * take care of that during sessionrc parsing
*/
- if (info->p->docks)
- {
- GList *iter = NULL;
-
- for (iter = info->p->docks; iter; iter = g_list_next (iter))
- gimp_session_info_dock_restore ((GimpSessionInfoDock *)iter->data,
- factory,
- screen,
- GIMP_DOCK_WINDOW (dialog));
- }
- else
- {
- gimp_session_info_dock_restore (NULL,
- factory,
- screen,
- GIMP_DOCK_WINDOW (dialog));
- }
+ for (iter = info->p->docks; iter; iter = g_list_next (iter))
+ gimp_session_info_dock_restore ((GimpSessionInfoDock *)iter->data,
+ factory,
+ screen,
+ GIMP_DOCK_WINDOW (dialog));
gtk_widget_show (dialog);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]