[gnome-commander] Fix gcmd crash after selecting an item in the bookmarks manager
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Fix gcmd crash after selecting an item in the bookmarks manager
- Date: Tue, 2 Aug 2016 19:49:33 +0000 (UTC)
commit 4e90c23e82994624de679cb8801ff3d47c764188
Author: Puux <puuxmine gmail com>
Date: Sun Jul 31 00:41:03 2016 +0300
Fix gcmd crash after selecting an item in the bookmarks manager
src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc | 36 +++++++++++++++++-----
src/dialogs/gnome-cmd-manage-bookmarks-dialog.h | 2 +
src/gnome-cmd-data.cc | 2 +
3 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
index 4120fac..a74d934 100644
--- a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
+++ b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.cc
@@ -65,6 +65,7 @@ enum
const int RESPONSE_JUMP_TO = 123;
+GtkWidget *view = NULL;
void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent)
{
@@ -79,7 +80,7 @@ void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent)
GtkWidget *content_area = gtk_dialog_get_content_area(GTK_DIALOG (dialog));
#endif
- GtkWidget *vbox, *hbox, *scrolled_window, *view, *button;
+ GtkWidget *vbox, *hbox, *scrolled_window, *button;
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
@@ -158,17 +159,13 @@ void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent)
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+ view = NULL;
}
-static GtkTreeModel *create_and_fill_model (GtkTreePath *¤t_group)
+static void fill_tree (GtkTreeStore *store, GtkTreePath *¤t_group)
{
- GtkTreeStore *store = gtk_tree_store_new (NUM_COLUMNS,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_STRING,
- G_TYPE_POINTER);
+ gtk_tree_store_clear (store);
GnomeCmdCon *current_con = main_win->fs(ACTIVE)->get_connection();
GtkTreeIter toplevel;
@@ -219,6 +216,19 @@ static GtkTreeModel *create_and_fill_model (GtkTreePath *¤t_group)
-1);
}
}
+}
+
+
+static GtkTreeModel *create_and_fill_model (GtkTreePath *¤t_group)
+{
+ GtkTreeStore *store = gtk_tree_store_new (NUM_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_POINTER);
+ fill_tree (store, current_group);
+
return GTK_TREE_MODEL (store);
}
@@ -290,6 +300,16 @@ static GtkWidget *create_view_and_model ()
}
+void gnome_cmd_update_bookmark_dialog ()
+{
+ if (view)
+ {
+ GtkTreePath *group = NULL;
+ fill_tree (GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))), group);
+ }
+}
+
+
static void cursor_changed_callback (GtkTreeView *view, GtkWidget *dialog)
{
GtkTreeModel *model = gtk_tree_view_get_model (view);
diff --git a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.h b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.h
index 83f9f2f..40aff2c 100644
--- a/src/dialogs/gnome-cmd-manage-bookmarks-dialog.h
+++ b/src/dialogs/gnome-cmd-manage-bookmarks-dialog.h
@@ -29,4 +29,6 @@ void gnome_cmd_bookmark_dialog_new (const gchar *title, GtkWindow *parent);
void gnome_cmd_bookmark_goto (GnomeCmdBookmark *bookmark);
void gnome_cmd_bookmark_add_current (GnomeCmdDir *dir);
+void gnome_cmd_update_bookmark_dialog ();
+
#endif // __GNOME_CMD_MANAGE_BOOKMARKS_DIALOG_H__
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 2e24f27..740e361 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -38,6 +38,7 @@
#include "utils.h"
#include "owner.h"
#include "dialogs/gnome-cmd-advrename-dialog.h"
+#include "dialogs/gnome-cmd-manage-bookmarks-dialog.h"
#include "gnome-cmd-gkeyfile-utils.h"
using namespace std;
@@ -1352,6 +1353,7 @@ static void settings_file_changes (GFileMonitor *monitor, GFile *file, GFile *ot
{
gnome_cmd_data.load ();
main_win->update_bookmarks ();
+ gnome_cmd_update_bookmark_dialog ();
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]