[gnome-latex: 24/205] - personal icons for compiling and viewing actions - close button in tabs smaller
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 24/205] - personal icons for compiling and viewing actions - close button in tabs smaller
- Date: Fri, 14 Dec 2018 10:48:54 +0000 (UTC)
commit cabae3b755b7b284bb7fe116faaefc05a29b7844
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Sat Aug 22 12:28:54 2009 +0200
- personal icons for compiling and viewing actions
- close button in tabs smaller
TODO | 2 +-
src/callbacks.c | 15 +++++++++++
src/callbacks.h | 1 +
src/icons/compile_latex.png | Bin 0 -> 2349 bytes
src/icons/compile_pdflatex.png | Bin 0 -> 2226 bytes
src/icons/view_dvi.png | Bin 0 -> 1449 bytes
src/icons/view_pdf.png | Bin 0 -> 1131 bytes
src/main.c | 56 ++++++++++++++++++++++++++++++++++++++---
src/main.h | 2 ++
src/ui.xml | 2 ++
10 files changed, 73 insertions(+), 5 deletions(-)
---
diff --git a/TODO b/TODO
index 350e4e4..fc26c54 100644
--- a/TODO
+++ b/TODO
@@ -19,7 +19,7 @@ Tue Aug 18, 2009 to Mon Aug 24, 2009
- write some text in the statusbar
- show which line and which column the cursor is
-[-] icons: PDF, DVI, ...
+[x] icons: PDF, DVI, ...
[-] DVI to PDF, DVI to PS
diff --git a/src/callbacks.c b/src/callbacks.c
index efe786f..fef3de4 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -237,6 +237,11 @@ cb_view_pdf (void)
view_document (_("View PDF"), ".pdf");
}
+void
+cb_dvi_to_pdf (void)
+{
+}
+
void
cb_action_list_changed (GtkTreeSelection *selection, gpointer user_data)
{
@@ -412,6 +417,11 @@ create_document_in_new_tab (const gchar *path, const gchar *text, const gchar *t
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
GtkWidget *close_button = gtk_button_new ();
+
+ // apply the style defined with gtk_rc_parse_string
+ // the button will be smaller
+ 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);
gtk_container_add (GTK_CONTAINER (close_button), image);
@@ -710,6 +720,11 @@ view_document (gchar *title, gchar *doc_extension)
}
}
+static void
+convert_document (gchar *title, gchar *command)
+{
+}
+
static void
add_action (gchar *title, gchar *command, gchar *command_output)
{
diff --git a/src/callbacks.h b/src/callbacks.h
index 36df104..139308e 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -14,6 +14,7 @@ void cb_latex (void);
void cb_pdflatex (void);
void cb_view_dvi (void);
void cb_view_pdf (void);
+void cb_dvi_to_pdf (void);
void cb_action_list_changed (GtkTreeSelection *selection,
gpointer user_data);
void cb_about_dialog (void);
diff --git a/src/icons/compile_latex.png b/src/icons/compile_latex.png
new file mode 100644
index 0000000..9b131e6
Binary files /dev/null and b/src/icons/compile_latex.png differ
diff --git a/src/icons/compile_pdflatex.png b/src/icons/compile_pdflatex.png
new file mode 100644
index 0000000..1c54a0a
Binary files /dev/null and b/src/icons/compile_pdflatex.png differ
diff --git a/src/icons/view_dvi.png b/src/icons/view_dvi.png
new file mode 100644
index 0000000..415bc8b
Binary files /dev/null and b/src/icons/view_dvi.png differ
diff --git a/src/icons/view_pdf.png b/src/icons/view_pdf.png
new file mode 100644
index 0000000..41bbe56
Binary files /dev/null and b/src/icons/view_pdf.png differ
diff --git a/src/main.c b/src/main.c
index 3df5b0d..917dd5e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -13,6 +13,37 @@
latexila_t latexila = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
+static struct {
+ gchar *filename;
+ gchar *stock_id;
+} stock_icons[] = {
+ {DATA_DIR "/icons/compile_latex.png", "compile_latex"},
+ {DATA_DIR "/icons/compile_pdflatex.png", "compile_pdflatex"},
+ {DATA_DIR "/icons/view_dvi.png", "view_dvi"},
+ {DATA_DIR "/icons/view_pdf.png", "view_pdf"}
+};
+
+static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
+
+static void
+register_my_stock_icons (void)
+{
+ GtkIconFactory *icon_factory = gtk_icon_factory_new ();
+
+ for (gint i = 0; i < n_stock_icons; i++)
+ {
+ GtkIconSet *icon_set = gtk_icon_set_new ();
+ GtkIconSource *icon_source = gtk_icon_source_new ();
+ gtk_icon_source_set_filename (icon_source, stock_icons[i].filename);
+ gtk_icon_set_add_source (icon_set, icon_source);
+ gtk_icon_source_free (icon_source);
+ gtk_icon_factory_add (icon_factory, stock_icons[i].stock_id, icon_set);
+ gtk_icon_set_unref (icon_set);
+ }
+ gtk_icon_factory_add_default (icon_factory);
+ g_object_unref (icon_factory);
+}
+
int
main (int argc, char *argv[])
{
@@ -23,6 +54,20 @@ main (int argc, char *argv[])
bindtextdomain ("latexila", "/usr/share/locale");
textdomain ("latexila");
+ /* personal style */
+ // make the close buttons in tabs smaller
+ // we use gtk_widget_set_name (widget, "my-close-button") to apply this
+ // style
+ gtk_rc_parse_string (
+ "style \"my-button-style\"\n"
+ "{\n"
+ " GtkWidget::focus-padding = 0\n"
+ " GtkWidget::focus-line-width = 0\n"
+ " xthickness = 0\n"
+ " ythickness = 0\n"
+ "}\n"
+ "widget \"*.my-close-button\" style \"my-button-style\"");
+
/* main window */
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event",
@@ -38,6 +83,7 @@ main (int argc, char *argv[])
gtk_container_add (GTK_CONTAINER (window), main_vbox);
/* menubar and toolbar */
+ register_my_stock_icons ();
// all the actions (for the menu and the toolbar)
// name, stock_id, label, accelerator, tooltip, callback
@@ -70,14 +116,16 @@ main (int argc, char *argv[])
{"View", NULL, _("View"), NULL, NULL, NULL},
{"LaTeX", NULL, "LaTeX", NULL, NULL, NULL},
- {"compile_latex", GTK_STOCK_EXECUTE, _("Compile (latex)"), "<Release>F5",
+ {"compile_latex", "compile_latex", _("Compile (latex)"), "<Release>F5",
_("Produce the document in DVI format"), G_CALLBACK (cb_latex)},
- {"viewDVI", GTK_STOCK_FILE, _("View DVI"), "<Release>F6",
+ {"viewDVI", "view_dvi", _("View DVI"), "<Release>F6",
_("View the DVI file"), G_CALLBACK (cb_view_dvi)},
- {"compile_pdflatex", GTK_STOCK_EXECUTE, _("Compile (pdflatex)"), "<Release>F7",
+ {"compile_pdflatex", "compile_pdflatex", _("Compile (pdflatex)"), "<Release>F7",
_("Produce the document in PDF format"), G_CALLBACK (cb_pdflatex)},
- {"viewPDF", GTK_STOCK_FILE, _("View PDF"), "<Release>F8",
+ {"viewPDF", "view_pdf", _("View PDF"), "<Release>F8",
_("View the PDF file"), G_CALLBACK (cb_view_pdf)},
+ {"DVItoPDF", NULL, _("DVI to PDF"), NULL,
+ _("Convert the DVI document to the PDF format"), G_CALLBACK (cb_dvi_to_pdf)},
{"Help", NULL, _("Help"), NULL, NULL, NULL},
{"HelpAbout", GTK_STOCK_ABOUT, _("About"), NULL,
diff --git a/src/main.h b/src/main.h
index 30b30eb..884a914 100644
--- a/src/main.h
+++ b/src/main.h
@@ -6,6 +6,8 @@
#define PROGRAM_NAME "LaTeXila"
#define PROGRAM_VERSION "0.0.1"
+#define DATA_DIR "/home/seb/dev/latexila/src"
+
#define FONT "Monospace"
// each document opened is represented by a document_t structure
diff --git a/src/ui.xml b/src/ui.xml
index 1c6c8c7..c1f0592 100644
--- a/src/ui.xml
+++ b/src/ui.xml
@@ -32,6 +32,8 @@ In the code, GtkUIManager is used to construct them.
<separator />
<menuitem action="compile_pdflatex" />
<menuitem action="viewPDF" />
+ <separator />
+ <menuitem action="DVItoPDF" />
</menu>
<menu action="Help">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]