[gnome-latex: 3/205] GUI: statusbar cleaning of the code : 80 columns max, space before each '('
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 3/205] GUI: statusbar cleaning of the code : 80 columns max, space before each '('
- Date: Fri, 14 Dec 2018 10:47:08 +0000 (UTC)
commit 65d43e5b21c5310c252c34f7c76cfc22ee7a8137
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Mon Jul 27 11:17:38 2009 +0200
GUI: statusbar
cleaning of the code : 80 columns max, space before each '('
Makefile | 2 +-
TODO | 4 ++--
main.c | 81 +++++++++++++++++++++++++++++++++++++++-------------------------
3 files changed, 52 insertions(+), 35 deletions(-)
---
diff --git a/Makefile b/Makefile
index d9cbf4e..7209fdc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -g -W -Wall -std=c99 $(shell pkg-config --cflags gtk+-2.0)
+CFLAGS = -g -W -Wall -std=c99 $(shell pkg-config --cflags gtk+-2.0) -DGTK_DISABLE_DEPRECATED=1
LDFLAGS = $(shell pkg-config --libs gtk+-2.0)
OBJ = main.o
diff --git a/TODO b/TODO
index 69870c2..21a5730 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,13 @@
TODO LaTeXila
-23/07/2009 au 30/07/2009
+23/07/2009 au 29/07/2009
[-] faire l'interface graphique
x menu
x barre d'outils
- zone de texte éditable (comme gedit)
- zone de log/messages
- - barre de status
+ x barre de status
[-] trouver plus de doc sur le développement d'application GNOME (un site qui regroupe tout ?)
x barre d'outils : boutons avec texte et icône qui changent selon les préférences définies dans GNOME
: texte en-dessous, icônes seules, etc.
diff --git a/main.c b/main.c
index e553398..e8862bc 100644
--- a/main.c
+++ b/main.c
@@ -4,15 +4,17 @@
#include <gtk/gtk.h>
static void
-menu_add_widget(GtkUIManager *ui_manager, GtkWidget *widget, GtkContainer *box)
+menu_add_widget (GtkUIManager *ui_manager, GtkWidget *widget, GtkContainer *box)
{
- gtk_box_pack_start(GTK_BOX(box), widget, FALSE, FALSE, 0);
- gtk_widget_show(widget);
+ gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0);
+ gtk_widget_show (widget);
}
int
main (int argc, char *argv[])
{
+ char *xml_file = "ui.xml";
+
// all the actions (for the menu and the toolbar)
// name, stock_id, label, accelerator, tooltip, callback
// the names come from the XML file
@@ -20,57 +22,72 @@ main (int argc, char *argv[])
{
{"File", NULL, "File", NULL, NULL, NULL},
{"FileNew", GTK_STOCK_NEW, "New", "<Control>N", "New file", NULL},
- {"FileOpen", GTK_STOCK_OPEN, "Open...", "<Control>O", "Open a file", NULL},
- {"FileSave", GTK_STOCK_SAVE, "Save...", "<Control>S", "Save the current file", NULL},
- {"FileSaveAs", GTK_STOCK_SAVE_AS, "Save as...", "<Shift><Control>S", "Save the current file
with a different name", NULL},
- {"FileQuit", GTK_STOCK_QUIT, "Quit", "<Control>Q", "Quit the program", gtk_main_quit},
+ {"FileOpen", GTK_STOCK_OPEN, "Open...", "<Control>O", "Open a file",
+ NULL},
+ {"FileSave", GTK_STOCK_SAVE, "Save...", "<Control>S",
+ "Save the current file", NULL},
+ {"FileSaveAs", GTK_STOCK_SAVE_AS, "Save as...", "<Shift><Control>S",
+ "Save the current file with a different name", NULL},
+ {"FileQuit", GTK_STOCK_QUIT, "Quit", "<Control>Q", "Quit the program",
+ gtk_main_quit},
{"Edit", NULL, "Edit", NULL, NULL, NULL},
- {"EditUndo", GTK_STOCK_UNDO, "Undo", "<Control>Z", "Undo the last action", NULL},
- {"EditRedo", GTK_STOCK_REDO, "Redo", "<Shift><Control>Z", "Redo the last undone action",
NULL},
+ {"EditUndo", GTK_STOCK_UNDO, "Undo", "<Control>Z",
+ "Undo the last action", NULL},
+ {"EditRedo", GTK_STOCK_REDO, "Redo", "<Shift><Control>Z",
+ "Redo the last undone action", NULL},
{"LaTeX", NULL, "LaTeX", NULL, NULL, NULL},
- {"compile_latex", GTK_STOCK_EXECUTE, "Compile (latex)", "<Release>F5", "Produce the document
in DVI format", NULL},
- {"viewDVI", GTK_STOCK_FILE, "View DVI", "<Release>F6", "View the DVI file", NULL},
- {"compile_pdflatex", GTK_STOCK_EXECUTE, "Compile (pdflatex)", "<Release>F7", "Produce the
document in PDF format", NULL},
- {"viewPDF", GTK_STOCK_FILE, "View PDF", "<Release>F8", "View the PDF file", NULL},
+ {"compile_latex", GTK_STOCK_EXECUTE, "Compile (latex)", "<Release>F5",
+ "Produce the document in DVI format", NULL},
+ {"viewDVI", GTK_STOCK_FILE, "View DVI", "<Release>F6",
+ "View the DVI file", NULL},
+ {"compile_pdflatex", GTK_STOCK_EXECUTE, "Compile (pdflatex)",
+ "<Release>F7", "Produce the document in PDF format", NULL},
+ {"viewPDF", GTK_STOCK_FILE, "View PDF", "<Release>F8",
+ "View the PDF file", NULL},
{"Help", NULL, "Help", NULL, NULL, NULL},
{"HelpAbout", GTK_STOCK_ABOUT, "About", NULL, "About LaTeXila", NULL}
};
- int nb_entries = sizeof(entries) / sizeof(entries[0]);
+ int nb_entries = sizeof (entries) / sizeof (entries[0]);
- gtk_init(&argc, &argv);
+ gtk_init (&argc, &argv);
- GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- g_signal_connect(G_OBJECT(window), "destroy",
- G_CALLBACK(gtk_main_quit), NULL);
- g_signal_connect(G_OBJECT(window), "delete_event",
- G_CALLBACK(gtk_main_quit), NULL);
- gtk_window_set_title(GTK_WINDOW(window), "LaTeXila");
+ GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_signal_connect (G_OBJECT (window), "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+ g_signal_connect (G_OBJECT (window), "delete_event",
+ G_CALLBACK (gtk_main_quit), NULL);
+ gtk_window_set_title (GTK_WINDOW (window), "LaTeXila");
- GtkWidget *main_vbox = gtk_vbox_new(FALSE, 0);
- gtk_container_add(GTK_CONTAINER(window), main_vbox);
+ GtkWidget *main_vbox = gtk_vbox_new (FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (window), main_vbox);
/* menubar */
- GtkUIManager *ui_manager = gtk_ui_manager_new();
- GtkActionGroup *action_group = gtk_action_group_new("menuActionGroup");
- gtk_action_group_add_actions(action_group, entries, nb_entries, NULL);
- gtk_ui_manager_insert_action_group(ui_manager, action_group, 0);
- int tmp = gtk_ui_manager_add_ui_from_file(ui_manager, "ui.xml", NULL);
+ GtkUIManager *ui_manager = gtk_ui_manager_new ();
+ GtkActionGroup *action_group = gtk_action_group_new ("menuActionGroup");
+ gtk_action_group_add_actions (action_group, entries, nb_entries, NULL);
+ gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
+ int tmp = gtk_ui_manager_add_ui_from_file (ui_manager, xml_file, NULL);
if (tmp == 0)
{
- fprintf(stderr, "Error with ui.xml\n");
+ fprintf (stderr, "Error with %s\n", xml_file);
return EXIT_FAILURE;
}
- g_signal_connect(ui_manager, "add-widget", G_CALLBACK(menu_add_widget), main_vbox);
+ g_signal_connect (ui_manager, "add-widget", G_CALLBACK (menu_add_widget),
+ main_vbox);
+
+ /* statusbar */
+ GtkWidget *statusbar = gtk_statusbar_new ();
+ gtk_box_pack_end (GTK_BOX (main_vbox), statusbar, FALSE, FALSE, 0);
- gtk_widget_show_all(window);
+ gtk_widget_show_all (window);
- gtk_main();
+ gtk_main ();
return EXIT_SUCCESS;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]