[gnome-latex: 124/205] File browser: jump button
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 124/205] File browser: jump button
- Date: Fri, 14 Dec 2018 10:57:18 +0000 (UTC)
commit c794a0c9089408a629c9c0039ac5b3b0a5bd37be
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Thu Nov 19 16:45:51 2009 +0100
File browser: jump button
There is a new button to jump to the directory of the current document.
TODO | 4 ++--
src/file_browser.c | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/TODO b/TODO
index de5d6ae..b68d2b6 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
TODO LaTeXila
-[-] File browser in the side bar
+[x] File browser in the side bar
x tabs to switch between "Symbols" and "File Browser"
x file browser integrated
x sort the files in alphabetical order
@@ -9,7 +9,7 @@ TODO LaTeXila
x other pixbuf for *.pdf, *.dvi and *.ps files
x if clicking on a *.pdf, *.dvi or *.ps file, show the document (add a new action)
x add an option in the preferences: show only *.tex, *.pdf, *.dvi, *.ps and *.bib files
- - add a button to jump to the directory of the current document
+ x add a button to jump to the directory of the current document
[-] Templates
- create a few default templates
diff --git a/src/file_browser.c b/src/file_browser.c
index 5c79596..49ff00c 100644
--- a/src/file_browser.c
+++ b/src/file_browser.c
@@ -35,6 +35,7 @@
static void fill_list_store_with_current_dir (void);
static void cb_go_to_home_dir (GtkButton *button, gpointer user_data);
static void cb_go_to_parent_dir (GtkButton *button, gpointer user_data);
+static void cb_jump_dir_current_doc (GtkButton *button, gpointer user_data);
static void cb_file_browser_row_activated (GtkTreeView *tree_view,
GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data);
static gint sort_list_alphabetical_order (gconstpointer a, gconstpointer b);
@@ -63,6 +64,16 @@ init_file_browser (void)
g_signal_connect (G_OBJECT (parent_dir_button), "clicked",
G_CALLBACK (cb_go_to_parent_dir), NULL);
+ // jump to the directory of the current document
+ GtkWidget *jump_button = gtk_button_new ();
+ gtk_button_set_relief (GTK_BUTTON (jump_button), GTK_RELIEF_NONE);
+ GtkWidget *jump_icon = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO,
+ GTK_ICON_SIZE_BUTTON);
+ gtk_container_add (GTK_CONTAINER (jump_button), jump_icon);
+ gtk_widget_set_tooltip_text (jump_button, _("Go to the directory of the current document"));
+ g_signal_connect (G_OBJECT (jump_button), "clicked",
+ G_CALLBACK (cb_jump_dir_current_doc), NULL);
+
// refresh
GtkWidget *refresh_button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (refresh_button), GTK_RELIEF_NONE);
@@ -76,6 +87,7 @@ init_file_browser (void)
GtkWidget *hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), home_button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), parent_dir_button, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), jump_button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), refresh_button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (latexila.file_browser.vbox), hbox,
FALSE, FALSE, 0);
@@ -276,6 +288,18 @@ cb_go_to_parent_dir (GtkButton *button, gpointer user_data)
fill_list_store_with_current_dir ();
}
+static void
+cb_jump_dir_current_doc (GtkButton *button, gpointer user_data)
+{
+ if (latexila.active_doc == NULL || latexila.active_doc->path == NULL)
+ return;
+
+ gchar *path = g_path_get_dirname (latexila.active_doc->path);
+ g_free (latexila.prefs.file_browser_dir);
+ latexila.prefs.file_browser_dir = path;
+ fill_list_store_with_current_dir ();
+}
+
static void
cb_file_browser_row_activated (GtkTreeView *tree_view, GtkTreePath *path,
GtkTreeViewColumn *column, gpointer user_data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]