summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-07-06 21:22:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-07-06 21:23:00 (GMT)
commitb4f47417b8bc7b7e97b1e60a35663d99155a92c2 (patch)
treeef4fd6a7dabc0ea71094a1360e00b2479c822076 /src/gui
parent4ffb572c4d6fdd429acc7e440de0cd2e98df9d50 (diff)
Replaced the use of a nested function in a delayed invocation by a direct call.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/panels/log.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c
index 0e9df9a..2fd8f4f 100644
--- a/src/gui/panels/log.c
+++ b/src/gui/panels/log.c
@@ -34,6 +34,7 @@
#include "panel-int.h"
#include "../core/panels.h"
+#include "../../gtkext/easygtk.h"
@@ -57,14 +58,6 @@ typedef struct _log_data
} log_data;
-/* Paramètres à transmettre pour un défilement */
-typedef struct _scroll_data
-{
- GtkTreeView *treeview; /* Affichage de la liste */
- GtkTreePath *path; /* Chemin d'accès à cibler */
-
-} scroll_data;
-
/* Panneau d'accueil (instance) */
struct _GLogPanel
@@ -401,8 +394,6 @@ static gboolean log_message(log_data *data)
GtkTreeStore *store; /* Modèle de gestion */
GtkTreeIter iter; /* Point d'insertion */
GtkTreeView *treeview; /* Affichage de la liste */
- GtkTreePath *path; /* Chemin d'accès à la ligne */
- scroll_data *sdata; /* Paramètres de défilement */
/* Mise en place du message */
@@ -459,30 +450,9 @@ static gboolean log_message(log_data *data)
/* Défilement pour pointer à l'affichage */
- gboolean wait_for_scrolling(scroll_data *_data)
- {
- gtk_tree_view_scroll_to_cell(_data->treeview, _data->path, NULL, FALSE, 0.0, 0.0);
-
- g_object_unref(G_OBJECT(_data->treeview));
- gtk_tree_path_free(_data->path);
-
- free(_data);
-
- return G_SOURCE_REMOVE;
-
- }
-
treeview = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(panel), "treeview"));
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter);
-
- sdata = (scroll_data *)calloc(1, sizeof(log_data));
-
- sdata->treeview = treeview;
- sdata->path = path;
-
- g_object_ref(G_OBJECT(sdata->treeview));
- g_idle_add((GSourceFunc)wait_for_scrolling, sdata);
+ scroll_to_treeview_iter(treeview, GTK_TREE_MODEL(store), &iter);
/* Nettoyage de la mémoire */