[Glade-devel] [patch, glade3] add status bar
- From: pborelli katamail com (paolo borelli)
- Subject: [Glade-devel] [patch, glade3] add status bar
- Date: 20 Mar 2003 18:48:43 +0100
--=-HqkRra1ideSgc9Wxvjun
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi!
The patch attached adds a statusbar to glade-3. Note that with this
patch the status bar doesn't display any messages yet; I hope to submit
other patches adding messages, but I'm still reflecting on how to handle
context_id... glade-2 just passed 1 having only 1 context, but since
glade-3 can handle multiple projects maybe it would be nice to have a
context per projet so that messages as "Project Saved" refer only to the
proper project... or maybe I misunderstood the whole thing? ;)
The patch also contains minor cleanups and some trivial ui changes I did
along the way, that make glade more similar to other gnome apps (add a
separator, move Help near the other menus and add a "New" button to the
toolbar).
Note that the patch, even if independent, is diffed against the last
patch I sent (glade_utils_hide_window); if you don't plan to apply that
one, tell me and I'll rediff this.
ciao
paolo
--=-HqkRra1ideSgc9Wxvjun
Content-Disposition: attachment; filename=status-bar.patch
Content-Type: text/x-patch; name=status-bar.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit
diff -pur ../glade3/ChangeLog glade3/ChangeLog
--- ../glade3/ChangeLog 2003-03-20 17:13:08.000000000 +0100
+++ glade3/ChangeLog 2003-03-20 17:52:05.000000000 +0100
@@ -1,3 +1,8 @@
+2003-03-20 Paolo Borelli <pborelli katamail com>
+
+ * src/glade-project-window.[ch]: implement the statusbar; minor
+ cleanups and ui love along the way.
+
2003-03-18 Paolo Borelli <pborelli katamail com>
* src/glade-utils.[ch]: intrduce glade_utils_hide_window()
diff -pur ../glade3/src/glade-project-window.c glade3/src/glade-project-window.c
--- ../glade3/src/glade-project-window.c 2003-03-20 17:13:08.000000000 +0100
+++ glade3/src/glade-project-window.c 2003-03-20 17:22:22.000000000 +0100
@@ -188,12 +188,6 @@ gpw_redo_cb (void)
glade_command_redo ();
}
-static void
-gpw_delete_event (GtkWindow *w, gpointer not_used)
-{
- gpw_quit_cb ();
-}
-
static GtkItemFactoryEntry menu_items[] =
{
@@ -201,9 +195,10 @@ static GtkItemFactoryEntry menu_items[]
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/_New", "<control>N", gpw_new_cb, 0, "<StockItem>", GTK_STOCK_NEW },
{ "/File/_Open", "<control>O", gpw_open_cb, 0, "<StockItem>", GTK_STOCK_OPEN },
+ { "/File/sep1", NULL, NULL, 0, "<Separator>" },
{ "/File/_Save", "<control>S", gpw_save_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
{ "/File/Save _As...", "<control><shift>S", gpw_save_as_cb, 0, "<StockItem>", GTK_STOCK_SAVE_AS },
- { "/File/sep1", NULL, NULL, 0, "<Separator>" },
+ { "/File/sep2", NULL, NULL, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gpw_quit_cb, 0, "<StockItem>", GTK_STOCK_QUIT },
@@ -228,13 +223,13 @@ static GtkItemFactoryEntry menu_items[]
{ "/Project", NULL, 0, 0, "<Branch>" },
/* ============ HELP ===================== */
- { "/_Help", NULL, NULL, 0, "<LastBranch>" },
+ { "/_Help", NULL, NULL, 0, "<Branch>" },
{ "/Help/_About", NULL, gpw_about_cb, 0 },
};
static void
-glade_project_window_construct_menu (GladeProjectWindow *gpw)
+gpw_construct_menu (GladeProjectWindow *gpw)
{
GtkItemFactory *item_factory;
GtkAccelGroup *accel_group;
@@ -246,7 +241,7 @@ glade_project_window_construct_menu (Gla
/* Item factory */
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
gpw->item_factory = item_factory;
- gtk_object_ref (GTK_OBJECT (item_factory));
+ g_object_ref (G_OBJECT (item_factory));
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_set_data_full (G_OBJECT (gpw->window),
"<main>",
@@ -261,12 +256,18 @@ glade_project_window_construct_menu (Gla
}
static void
-glade_project_window_construct_toolbar (GladeProjectWindow *gpw)
+gpw_construct_toolbar (GladeProjectWindow *gpw)
{
GtkWidget *toolbar;
toolbar = gtk_toolbar_new ();
-
+
+ gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+ GTK_STOCK_NEW,
+ "New project",
+ NULL,
+ G_CALLBACK (gpw_new_cb),
+ gpw, -1);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"Open project",
@@ -293,6 +294,24 @@ glade_project_window_construct_toolbar (
toolbar);
}
+static void
+gpw_construct_statusbar (GladeProjectWindow *gpw)
+{
+ GtkWidget *statusbar;
+
+ statusbar = gtk_statusbar_new ();
+ gpw->statusbar = statusbar;
+
+ g_object_ref (G_OBJECT (statusbar));
+ gtk_object_sink (GTK_OBJECT (statusbar));
+ g_object_set_data_full (G_OBJECT (gpw->window),
+ "<main>",
+ statusbar,
+ (GDestroyNotify) g_object_unref);
+
+ gtk_box_pack_end_defaults (GTK_BOX (gpw->main_vbox), statusbar);
+}
+
static gboolean
gpw_hide_palette_on_delete (GtkWidget *palette, gpointer not_used,
GtkItemFactory *item_factory)
@@ -659,6 +678,12 @@ gpw_toggle_clipboard_cb (void)
gpw_hide_clipboard_view (gpw);
}
+static void
+gpw_delete_event (GtkWindow *w, gpointer not_used)
+{
+ gpw_quit_cb ();
+}
+
static GtkWidget *
glade_project_window_create (GladeProjectWindow *gpw, GladeProjectView *view)
{
@@ -673,8 +698,10 @@ glade_project_window_create (GladeProjec
gtk_container_add (GTK_CONTAINER (app), vbox);
gpw->main_vbox = vbox;
- glade_project_window_construct_menu (gpw);
- glade_project_window_construct_toolbar (gpw);
+ gpw_construct_menu (gpw);
+ gpw_construct_toolbar (gpw);
+ gpw_construct_statusbar (gpw);
+
glade_project_window_refresh_undo_redo (gpw);
g_signal_connect (G_OBJECT (app), "delete_event",
Only in glade3/src: glade-project-window.c~
diff -pur ../glade3/src/glade-project-window.h glade3/src/glade-project-window.h
--- ../glade3/src/glade-project-window.h 2003-03-20 17:12:21.000000000 +0100
+++ glade3/src/glade-project-window.h 2003-03-20 17:54:25.000000000 +0100
@@ -13,11 +13,10 @@ G_BEGIN_DECLS
struct _GladeProjectWindow
{
- GtkWidget *window; /* Main window*/
+ GtkWidget *window; /* Main window */
GtkWidget *main_vbox;
- GtkWidget *statusbar; /* A pointer to the (not yet implemented)
- * status bar. We might have to come up with
- * a glade-statusbar object if it makes sense
+ GtkWidget *statusbar; /* A pointer to the status bar. We might have to come
+ * up with a glade-statusbar object if it makes sense
*/
GtkItemFactory *item_factory; /* A pointer to the Item factory.
* We need it to be able to later add
--=-HqkRra1ideSgc9Wxvjun--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]