Skip to content

Commit

Permalink
Implemented Glade UI in Glade, side effect status bar started working…
Browse files Browse the repository at this point in the history
… again

src/glade-window.c:
 Use GtkBuilder and GResources to build GladeWindow contents
 Implemented menu with GtkActions
 Push tooltip for rencet manager and project actions

src/main.c: Register glade GResources

src/glade-resources.gresources.xml: Glade Gresource file

src/glade.glade: Glade UI GladeWindow, about and preferences dialog

src/glade-callbacks.h: callbacks declarations

src/Makefile.am: added glade-resource.c to source list

configure.ac:
 bumped version to 3.13
 added glib-compile-resources path program

glade-rules.mk: added common rules for GResources files
  • Loading branch information
xjuan committed Apr 27, 2012
1 parent f326453 commit cb69ca9
Show file tree
Hide file tree
Showing 9 changed files with 1,994 additions and 1,030 deletions.
11 changes: 10 additions & 1 deletion configure.ac
Expand Up @@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.52)

m4_define(glade_major_version, 3)
m4_define(glade_minor_version, 11)
m4_define(glade_minor_version, 13)
m4_define(glade_micro_version, 0)
m4_define(glade_version, glade_major_version.glade_minor_version.glade_micro_version)

Expand Down Expand Up @@ -42,6 +42,7 @@ AC_PROG_MAKE_SET
LT_PREREQ([2.2.6])
LT_INIT([dlopen win32-dll disable-static])

AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
AC_PATH_PROG(DLLTOOL, dlltool)

Expand Down Expand Up @@ -134,6 +135,9 @@ PKG_CHECK_MODULES([GTK],[
libxml-2.0 >= 2.4.0
])

PKG_CHECK_MODULES([GMODULE_EXPORT],[
gmodule-export-2.0
])

dnl ================================================================
dnl Check for the unix print widgets in gtk+
Expand Down Expand Up @@ -245,6 +249,11 @@ if test "x$_gdk_tgt" = xquartz; then
AC_SUBST(GTK_MAC_CFLAGS)
fi

dnl ================================================================
dnl Check for extra functions
dnl ================================================================
AC_CHECK_FUNCS(gtk_builder_add_from_resource)


AC_SUBST([GLADE_PREFIX])

Expand Down
17 changes: 17 additions & 0 deletions glade-rules.mk
@@ -0,0 +1,17 @@
# In this file you will find generic and usefull rules to

# GResource rules:
# These rules will create source and header files for any file ending with .gresource.xml
# You will have to manually load the resourse unless the file name ends with
# .static.gresource.xml in which case it will be loaded automatically

%.h: %.gresource.xml
$(GLIB_COMPILE_RESOURCES) --manual-register --generate $< --target=$@
%.c: %.gresource.xml
$(GLIB_COMPILE_RESOURCES) --manual-register --generate $< --target=$@

# rule for static resources
%.h: %.static.gresource.xml
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@
%.c: %.static.gresource.xml
$(GLIB_COMPILE_RESOURCES) --generate $< --target=$@
16 changes: 15 additions & 1 deletion src/Makefile.am
@@ -1,4 +1,5 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/glade-rules.mk

bin_PROGRAMS = glade

Expand All @@ -12,19 +13,32 @@ glade_CPPFLAGS = \
$(AM_CPPFLAGS)

glade_CFLAGS = \
$(GMODULE_EXPORT_CFLAGS) \
$(AM_CFLAGS)

glade_LDFLAGS = $(AM_LDFLAGS)
glade_LDFLAGS = $(AM_LDFLAGS) $(GMODULE_EXPORT_LDFLAGS)

glade_LDADD = $(top_builddir)/gladeui/libgladeui-2.la $(GTK_MAC_LIBS)

BUILT_SOURCES = glade-resources.c glade-resources.h

glade_SOURCES = \
glade-window.c \
glade-window.h \
glade-close-button.c \
glade-close-button.h \
glade-resources.c \
glade-callbacks.h \
main.c

noinst_HEADERS = \
glade-resources.h

# This could be split in two, but its better to rebuild both, sources and header
# each time the xml or the actual resources files change, just in case.
glade-resources.c glade-resources.h: glade-resources.gresource.xml \
$(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies glade-resources.gresource.xml)

if NATIVE_WIN32
glade_LDADD += glade-win32-res.o
if !GLADE_UNSTABLE
Expand Down
89 changes: 89 additions & 0 deletions src/glade-callbacks.h
@@ -0,0 +1,89 @@
/*
* Copyright (C) 2012 Juan Pablo Ugarte.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Authors:
* Juan Pablo Ugarte <juanpablougarte@gmail.com>
*/

#ifndef __GLADE_CALLBACKS_H__
#define __GLADE_CALLBACKS_H__

#include "glade-window.h"
#include <gladeui/glade-design-view.h>

void on_open_action_activate (GtkAction *action, GladeWindow *window);
void on_save_action_activate (GtkAction *action, GladeWindow *window);
void on_save_as_action_activate (GtkAction *action, GladeWindow *window);
void on_close_action_activate (GtkAction *action, GladeWindow *window);
void on_copy_action_activate (GtkAction *action, GladeWindow *window);
void on_cut_action_activate (GtkAction *action, GladeWindow *window);
void on_paste_action_activate (GtkAction *action, GladeWindow *window);
void on_delete_action_activate (GtkAction *action, GladeWindow *window);
void on_properties_action_activate (GtkAction *action, GladeWindow *window);
void on_undo_action_activate (GtkAction *action, GladeWindow *window);
void on_redo_action_activate (GtkAction *action, GladeWindow *window);
void on_quit_action_activate (GtkAction *action, GladeWindow *window);
void on_about_action_activate (GtkAction *action, GladeWindow *window);
void on_reference_action_activate (GtkAction *action, GladeWindow *window);

void on_open_recent_action_item_activated (GtkRecentChooser *chooser,
GladeWindow *window);

void on_use_small_icons_action_toggled (GtkAction *action, GladeWindow *window);
void on_dock_action_toggled (GtkAction *action, GladeWindow *window);
void on_toolbar_visible_action_toggled (GtkAction *action, GladeWindow *window);
void on_statusbar_visible_action_toggled (GtkAction *action, GladeWindow *window);
void on_project_tabs_visible_action_toggled (GtkAction *action, GladeWindow *window);

void on_palette_appearance_radioaction_changed (GtkRadioAction *action,
GtkRadioAction *current,
GladeWindow *window);
void on_selector_radioaction_changed (GtkRadioAction *action,
GtkRadioAction *current,
GladeWindow *window);

void on_actiongroup_connect_proxy (GtkActionGroup *action_group,
GtkAction *action,
GtkWidget *proxy,
GladeWindow *window);
void on_actiongroup_disconnect_proxy (GtkActionGroup *action_group,
GtkAction *action,
GtkWidget *proxy,
GladeWindow *window);

void on_notebook_switch_page (GtkNotebook *notebook,
GtkWidget *page,
guint page_num,
GladeWindow *window);
void on_notebook_tab_added (GtkNotebook *notebook,
GladeDesignView *view,
guint page_num,
GladeWindow *window);
void on_notebook_tab_removed (GtkNotebook *notebook,
GladeDesignView *view,
guint page_num,
GladeWindow *window);

void on_recent_menu_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position,
GladeWindow *window);
void on_recent_menu_remove (GtkContainer *container,
GtkWidget *widget,
GladeWindow *window);

#endif
6 changes: 6 additions & 0 deletions src/glade-resources.gresource.xml
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/glade">
<file compressed="true" preprocess="xml-stripblanks">glade.glade</file>
</gresource>
</gresources>

0 comments on commit cb69ca9

Please sign in to comment.