[gnome-latex: 103/205] Side bar: tabs with icons
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 103/205] Side bar: tabs with icons
- Date: Fri, 14 Dec 2018 10:55:32 +0000 (UTC)
commit 148840b7896471f48ad9c556499c75fe8f05b774
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Tue Oct 27 19:44:45 2009 +0100
Side bar: tabs with icons
Tabs to switch between "Symbols" and "File Browser"
TODO | 12 ++++++++++++
src/callbacks.c | 11 ++++++-----
src/callbacks.h | 2 +-
src/main.c | 36 ++++++++++++++++++++++++++++++++----
src/main.h | 1 +
src/ui.c | 10 +++++-----
src/ui.xml | 2 +-
7 files changed, 58 insertions(+), 16 deletions(-)
---
diff --git a/TODO b/TODO
index df21b85..ec23a59 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,17 @@
TODO LaTeXila
+[-] File browser in the side bar
+ x tabs to switch between "Symbols" and "File Browser"
+ - file browser integrated
+
+[-] Templates
+ - create a few default templates
+ - on the action "new file", possibility to select a template
+ - possibility to create new templates
+ - possibility to delete templates (not the defaults)
+
+[-] BibTeX support
+
[-] undo/redo and the "saved" document property
- detect when the buffer is the same as in the file currently saved
diff --git a/src/callbacks.c b/src/callbacks.c
index d188302..0c5d2d1 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -750,18 +750,18 @@ cb_recent_item_activated (GtkRecentAction *action, gpointer user_data)
}
void
-cb_show_symbol_tables (GtkToggleAction *toggle_action, gpointer user_data)
+cb_show_side_pane (GtkToggleAction *toggle_action, gpointer user_data)
{
- if (latexila.symbols.vbox == NULL)
+ if (latexila.side_pane == NULL)
return;
latexila.prefs.show_side_pane =
gtk_toggle_action_get_active (toggle_action);
if (latexila.prefs.show_side_pane)
- gtk_widget_show_all (latexila.symbols.vbox);
+ gtk_widget_show_all (latexila.side_pane);
else
- gtk_widget_hide (latexila.symbols.vbox);
+ gtk_widget_hide (latexila.side_pane);
}
void
@@ -928,7 +928,8 @@ create_document_in_new_tab (const gchar *path, const gchar *text,
gtk_widget_set_name (close_button, "my-close-button");
gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
- GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
+ GtkWidget *image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
+ GTK_ICON_SIZE_MENU);
gtk_container_add (GTK_CONTAINER (close_button), image);
g_signal_connect (G_OBJECT (close_button), "clicked",
G_CALLBACK (cb_close_tab), sw);
diff --git a/src/callbacks.h b/src/callbacks.h
index 0368501..4990c30 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -59,7 +59,7 @@ void cb_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num,
gboolean cb_delete_event (GtkWidget *widget, GdkEvent *event,
gpointer user_data);
void cb_recent_item_activated (GtkRecentAction *action, gpointer user_data);
-void cb_show_symbol_tables (GtkToggleAction *toggle_action, gpointer user_data);
+void cb_show_side_pane (GtkToggleAction *toggle_action, gpointer user_data);
void cb_show_edit_toolbar (GtkToggleAction *toggle_action, gpointer user_data);
void open_new_document (const gchar *filename, const gchar *uri);
diff --git a/src/main.c b/src/main.c
index fa6ae7a..1179b3e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -157,7 +157,7 @@ main (int argc, char *argv[])
init_ui (main_vbox);
/* horizontal pane
- * left: symbol tables
+ * left: side pane (symbol tables and the file navigator)
* right: the source view and the log zone
*/
GtkWidget *main_hpaned = gtk_hpaned_new ();
@@ -166,13 +166,41 @@ main (int argc, char *argv[])
latexila.prefs.main_hpaned_pos);
gtk_box_pack_start (GTK_BOX (main_vbox), main_hpaned, TRUE, TRUE, 0);
- /* symbol tables */
+ /* side pane */
+ GtkWidget *side_pane_notebook = gtk_notebook_new ();
+ latexila.side_pane = side_pane_notebook;
+ gtk_notebook_set_scrollable (GTK_NOTEBOOK (side_pane_notebook), TRUE);
+ gtk_paned_add1 (GTK_PANED (main_hpaned), side_pane_notebook);
+
+ // symbol tables
GtkWidget *vbox_symbols = gtk_vbox_new (FALSE, 0);
latexila.symbols.vbox = vbox_symbols;
- gtk_paned_add1 (GTK_PANED (main_hpaned), vbox_symbols);
+ GtkWidget *tab_label = gtk_hbox_new (FALSE, 3);
+ GtkWidget *label = gtk_label_new (_("Symbols"));
+ GtkWidget *image = gtk_image_new_from_file (DATA_DIR "/images/greek/01.png");
+ gtk_box_pack_start (GTK_BOX (tab_label), image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab_label), label, TRUE, TRUE, 0);
+ gtk_widget_show_all (tab_label);
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (side_pane_notebook), vbox_symbols,
+ tab_label);
init_symbols ();
+ // file navigator
+ GtkWidget *vbox_file_navigator = gtk_vbox_new (FALSE, 0);
+
+ tab_label = gtk_hbox_new (FALSE, 3);
+ label = gtk_label_new (_("File Browser"));
+ image = gtk_image_new_from_stock (GTK_STOCK_OPEN,
+ GTK_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (tab_label), image, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (tab_label), label, TRUE, TRUE, 0);
+ gtk_widget_show_all (tab_label);
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (side_pane_notebook),
+ vbox_file_navigator, tab_label);
+
/* vertical pane
* top: source view
* bottom: log zone
@@ -276,7 +304,7 @@ main (int argc, char *argv[])
gtk_widget_show_all (window);
if (! latexila.prefs.show_side_pane)
- gtk_widget_hide (latexila.symbols.vbox);
+ gtk_widget_hide (latexila.side_pane);
if (! latexila.prefs.show_edit_toolbar)
gtk_widget_hide (latexila.edit_toolbar);
diff --git a/src/main.h b/src/main.h
index b6ad125..1a1d567 100644
--- a/src/main.h
+++ b/src/main.h
@@ -115,6 +115,7 @@ typedef struct
GtkPaned *vpaned;
GtkPaned *log_hpaned;
GtkWidget *edit_toolbar;
+ GtkWidget *side_pane;
} latexila_t;
// a lot of things are accessible by the "latexila" variable everywhere in the
diff --git a/src/ui.c b/src/ui.c
index 9ea9405..092249e 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -254,8 +254,8 @@ static GtkActionEntry latex_entries[] = {
// {name, stock_id, label, accelerator, tooltip, callback}
static GtkToggleActionEntry toggle_entries[] = {
- {"ViewSymbols", NULL, N_("Symbol tables"), NULL,
- N_("Show or hide the symbol tables"), G_CALLBACK (cb_show_symbol_tables)},
+ {"ViewSidePane", NULL, N_("Side pane"), NULL,
+ N_("Show or hide the side pane"), G_CALLBACK (cb_show_side_pane)},
{"ViewEditToolbar", NULL, N_("Edit Toolbar"), NULL,
N_("Show or hide the edit toolbar"), G_CALLBACK (cb_show_edit_toolbar)},
};
@@ -390,9 +390,9 @@ init_ui (GtkWidget *box)
"viewPS");
- GtkToggleAction *show_symbol_tables = GTK_TOGGLE_ACTION (
- gtk_action_group_get_action (action_group, "ViewSymbols"));
- gtk_toggle_action_set_active (show_symbol_tables,
+ GtkToggleAction *show_side_pane = GTK_TOGGLE_ACTION (
+ gtk_action_group_get_action (action_group, "ViewSidePane"));
+ gtk_toggle_action_set_active (show_side_pane,
latexila.prefs.show_side_pane);
GtkToggleAction *show_edit_toolbar = GTK_TOGGLE_ACTION (
diff --git a/src/ui.xml b/src/ui.xml
index 366df09..8a66631 100644
--- a/src/ui.xml
+++ b/src/ui.xml
@@ -50,7 +50,7 @@ In the code, GtkUIManager is used to construct them.
</menu>
<menu action="View">
- <menuitem action="ViewSymbols" />
+ <menuitem action="ViewSidePane" />
<menuitem action="ViewEditToolbar" />
<separator />
<menuitem action="ViewZoomIn" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]