Commit c6346f38 authored by Tristan Van Berkom's avatar Tristan Van Berkom

put me as an author, removed the introductory chapter and added its


	* doc/gladeui-docs.sgml: put me as an author, removed the introductory
	  chapter and added its content as the "abstract".

	* src/glade-editor.c: Fixed a visibility bug on the class & name entries.

	* src/glade-devhelp.[ch], src/glade-utils.c, src/glade-project-window.c:
	  o Added navigational buttons (forward, back)
	  o Gained realestate by hiding the notebook tabs and putting search &
	    document buttons along side the navigational buttons.
	  o Added api to return a list of buttons in the hbox
	  o Get the buttons and put them in a size group with the expand/collapse
	    buttons (to align the plugin buttons in the project window).
parent 45bcece3
2006-04-28 Vincent Geddes <vgeddes@metroweb.co.za>
2006-05-01 Tristan Van Berkom <tvb@gnome.org>
* doc/gladeui-docs.sgml: put me as an author, removed the introductory
chapter and added its content as the "abstract".
* src/glade-editor.c: Fixed a visibility bug on the class & name entries.
* src/glade-devhelp.[ch], src/glade-utils.c, src/glade-project-window.c:
o Added navigational buttons (forward, back)
o Gained realestate by hiding the notebook tabs and putting search &
document buttons along side the navigational buttons.
o Added api to return a list of buttons in the hbox
o Get the buttons and put them in a size group with the expand/collapse
buttons (to align the plugin buttons in the project window).
2006-04-30 Vincent Geddes <vgeddes@metroweb.co.za>
* Glade now installs theme friendly icons (GNOME Goal #2)
......
......@@ -28,23 +28,15 @@
<book id="index">
<bookinfo>
<title>Glade UI Builder Reference Manual</title>
<releaseinfo>&version;</releaseinfo>
</bookinfo>
<releaseinfo>for &version;</releaseinfo>
<authorgroup>
<author>
<firstname>Tristan</firstname>
<surname>Van Berkom</surname>
</author>
</authorgroup>
<part id="intro">
<title>Introduction</title>
<partintro>
<para>
This document attempts to describe how to use the Glade UI Builder core
library to integrate Glade into your application and how to integrate your
custom (GTK+ based) widget toolkit into the Glade UI Builder.
</para>
<para>
You can always get the latest version of this document here (XXX linkme)
and you should have recieved a copy with the glade-3 tarball.
</para>
</partintro>
</part>
</bookinfo>
<part id="catalog">
<title>Adding your custom widgets</title>
......@@ -63,13 +55,13 @@ and you should have recieved a copy with the glade-3 tarball.
&GladeWidgetClass;
&GladePropertyClass;
&GladeCommand;
&GladeEditorProperty;
&GladeClipboard;
</part>
<part id="dockables">
<title>Dockable Glade UI Widgets</title>
&GladeEditor;
&GladeEditorProperty;
&GladePalette;
&GladeClipboardView;
&GladeProjectView;
......
......@@ -25,11 +25,26 @@ a simple unified api to them.
</para>
<!-- ##### SIGNAL GladeEditorProperty::gtk-doc-search ##### -->
<para>
</para>
@gladeeditorproperty: the object which received the signal.
@arg1:
@arg2:
@arg3:
<!-- ##### ARG GladeEditorProperty:property-class ##### -->
<para>
</para>
<!-- ##### ARG GladeEditorProperty:show-info ##### -->
<para>
</para>
<!-- ##### ARG GladeEditorProperty:use-command ##### -->
<para>
......
......@@ -24,6 +24,26 @@ configure a #GladeWidget.
</para>
<!-- ##### SIGNAL GladeEditor::gtk-doc-search ##### -->
<para>
</para>
@gladeeditor: the object which received the signal.
@arg1:
@arg2:
@arg3:
<!-- ##### ARG GladeEditor:show-context-info ##### -->
<para>
</para>
<!-- ##### ARG GladeEditor:show-info ##### -->
<para>
</para>
<!-- ##### FUNCTION glade_editor_new ##### -->
<para>
......
......@@ -29,6 +29,7 @@ va_lists etc (back and forth).
@id:
@name:
@tooltip:
@virtual:
@def:
@orig_def:
@parameters:
......
......@@ -30,6 +30,7 @@
#include <devhelp/dh-search.h>
#include <devhelp/dh-base.h>
#include "glade-devhelp.h"
#include "glade.h"
struct _GladeDhWidgetPriv {
DhBase *base;
......@@ -43,6 +44,13 @@ struct _GladeDhWidgetPriv {
GtkWidget *book_tree;
GtkWidget *search;
/* Notebook buttons in hbuttonbox */
GtkWidget *html_button;
GtkWidget *search_button;
/* Navigator buttons */
GtkWidget *forward;
GtkWidget *back;
};
static void widget_class_init (GladeDhWidgetClass *klass);
......@@ -69,7 +77,14 @@ static void widget_html_open_new_tab_cb (DhHtml *html,
static void widget_open_new_tab (GladeDhWidget *widget,
const gchar *location);
static DhHtml * widget_get_active_html (GladeDhWidget *widget);
static void widget_go_forward (GtkButton *button,
GladeDhWidget *widget);
static void widget_go_back (GtkButton *button,
GladeDhWidget *widget);
static void widget_document_page (GtkButton *button,
GladeDhWidget *widget);
static void widget_search_page (GtkButton *button,
GladeDhWidget *widget);
static GtkVBoxClass *parent_class = NULL;
......@@ -180,6 +195,47 @@ widget_html_switch_page_cb (GtkNotebook *notebook,
}
typedef enum {
NAV_FORWARD,
NAV_BACK,
NAV_SEARCH,
NAV_DOCUMENT
} NavButtonType;
static GtkWidget *
widget_create_nav_button (NavButtonType type)
{
GtkWidget *image, *button, *align, *hbox;
gchar *path;
button = gtk_button_new ();
hbox = gtk_hbox_new (FALSE, 0);
if (type == NAV_DOCUMENT)
{
path = g_build_filename (glade_pixmaps_dir, "devhelp.png", NULL);
image = gtk_image_new_from_file (path);
}
else
image = gtk_image_new_from_stock
(type == NAV_FORWARD ? GTK_STOCK_GO_FORWARD :
type == NAV_BACK ? GTK_STOCK_GO_BACK : GTK_STOCK_FIND,
GTK_ICON_SIZE_SMALL_TOOLBAR);
align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, FALSE, 0);
gtk_container_add (GTK_CONTAINER (align), hbox);
gtk_widget_show_all (align);
gtk_container_add (GTK_CONTAINER (button), align);
gtk_container_set_border_width (GTK_CONTAINER (button),
GLADE_GENERIC_BORDER_WIDTH);
return button;
}
static void
widget_populate (GladeDhWidget *widget)
{
......@@ -187,32 +243,33 @@ widget_populate (GladeDhWidget *widget)
GtkWidget *book_tree_sw, *book_and_search;
GNode *contents_tree;
GList *keywords;
GtkWidget *hbox;
priv = widget->priv;
/* Master notebook
*/
priv->control_notebook = gtk_notebook_new();
gtk_box_pack_start (GTK_BOX (widget), priv->control_notebook, TRUE, TRUE, 0);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->control_notebook), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (priv->control_notebook),
GLADE_GENERIC_BORDER_WIDTH);
/* HTML tabs notebook. */
priv->html_notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->html_notebook), FALSE);
g_signal_connect (priv->html_notebook,
"switch-page",
g_signal_connect (priv->html_notebook, "switch-page",
G_CALLBACK (widget_html_switch_page_cb),
widget);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->control_notebook),
priv->html_notebook,
gtk_label_new (_("Content")));
priv->html_notebook, NULL);
/* Book and search page */
book_and_search = gtk_hbox_new(FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (book_and_search),
GLADE_GENERIC_BORDER_WIDTH);
book_tree_sw = gtk_scrolled_window_new (NULL, NULL);
......@@ -221,7 +278,6 @@ widget_populate (GladeDhWidget *widget)
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (book_tree_sw),
GTK_SHADOW_IN);
gtk_container_set_border_width (GTK_CONTAINER (book_tree_sw), 2);
contents_tree = dh_base_get_book_tree (priv->base);
keywords = dh_base_get_keywords (priv->base);
......@@ -231,8 +287,7 @@ widget_populate (GladeDhWidget *widget)
gtk_container_add (GTK_CONTAINER (book_tree_sw),
priv->book_tree);
g_signal_connect (priv->book_tree,
"link-selected",
g_signal_connect (priv->book_tree, "link-selected",
G_CALLBACK (widget_tree_link_selected_cb),
widget);
......@@ -241,8 +296,7 @@ widget_populate (GladeDhWidget *widget)
priv->search = dh_search_new (keywords);
g_signal_connect (priv->search,
"link-selected",
g_signal_connect (priv->search, "link-selected",
G_CALLBACK (widget_search_link_selected_cb),
widget);
......@@ -250,34 +304,61 @@ widget_populate (GladeDhWidget *widget)
FALSE, FALSE, 0);
gtk_notebook_append_page (GTK_NOTEBOOK (priv->control_notebook),
book_and_search,
gtk_label_new (_("Contents and Search")));
book_and_search, NULL);
/* Connect after we're all built
*/
g_signal_connect (priv->control_notebook,
"switch-page",
g_signal_connect (priv->control_notebook, "switch-page",
G_CALLBACK (widget_control_switch_page_cb),
widget);
g_signal_connect_after (priv->control_notebook,
"switch-page",
g_signal_connect_after (priv->control_notebook, "switch-page",
G_CALLBACK (widget_control_after_switch_page_cb),
widget);
/* Build navigator buttons
*/
hbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_START);
priv->forward = widget_create_nav_button (NAV_FORWARD);
g_signal_connect (G_OBJECT (priv->forward), "clicked",
G_CALLBACK (widget_go_forward), widget);
priv->back = widget_create_nav_button (NAV_BACK);
g_signal_connect (G_OBJECT (priv->back), "clicked",
G_CALLBACK (widget_go_back), widget);
priv->html_button = widget_create_nav_button (NAV_DOCUMENT);
g_signal_connect (G_OBJECT (priv->html_button), "clicked",
G_CALLBACK (widget_document_page), widget);
priv->search_button = widget_create_nav_button (NAV_SEARCH);
g_signal_connect (G_OBJECT (priv->search_button), "clicked",
G_CALLBACK (widget_search_page), widget);
gtk_box_pack_start (GTK_BOX (hbox), priv->back, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), priv->forward, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), priv->html_button, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), priv->search_button, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (widget), priv->control_notebook, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (widget), hbox, FALSE, FALSE, 0);
gtk_widget_show_all (GTK_WIDGET (widget));
}
#if FORWARD_BACK_CODE_HERE
static void
window_activate_back (GtkAction *action, GladeDhWidget *window)
widget_go_back (GtkButton *button,
GladeDhWidget *widget)
{
GladeDhWidgetPriv *priv;
DhHtml *html;
GtkWidget *frame;
DhHtml *html;
GtkWidget *frame;
priv = window->priv;
priv = widget->priv;
frame = gtk_notebook_get_nth_page (
GTK_NOTEBOOK (priv->html_notebook),
......@@ -288,24 +369,39 @@ window_activate_back (GtkAction *action, GladeDhWidget *window)
}
static void
window_activate_forward (GtkAction *action,
GladeDhWidget *window)
widget_go_forward (GtkButton *button,
GladeDhWidget *widget)
{
GladeDhWidgetPriv *priv;
DhHtml *html;
GtkWidget *frame;
DhHtml *html;
GtkWidget *frame;
priv = window->priv;
priv = widget->priv;
frame = gtk_notebook_get_nth_page (GTK_NOTEBOOK (priv->html_notebook),
gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->html_notebook))
);
gtk_notebook_get_current_page
(GTK_NOTEBOOK (priv->html_notebook)));
html = g_object_get_data (G_OBJECT (frame), "html");
dh_html_go_forward (html);
}
#endif
static void
widget_search_page (GtkButton *button,
GladeDhWidget *widget)
{
gtk_notebook_set_current_page
(GTK_NOTEBOOK (widget->priv->control_notebook), 1);
}
static void
widget_document_page (GtkButton *button,
GladeDhWidget *widget)
{
gtk_notebook_set_current_page
(GTK_NOTEBOOK (widget->priv->control_notebook), 0);
}
static void
widget_tree_link_selected_cb (GObject *ignored,
......@@ -359,10 +455,10 @@ widget_check_history (GladeDhWidget *widget, DhHtml *html)
priv = widget->priv;
/* XXX Set sensitivity of "Back" button to the following: */
/* html ? dh_html_can_go_back (html) : FALSE (same for forward) */
gtk_widget_set_sensitive (priv->forward,
html ? dh_html_can_go_forward (html) : FALSE);
gtk_widget_set_sensitive (priv->back,
html ? dh_html_can_go_back (html) : FALSE);
}
static void
......@@ -516,6 +612,24 @@ glade_dh_widget_search (GladeDhWidget *widget, const gchar *str)
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->control_notebook), 0);
}
GList *
glade_dh_get_hbuttons (GladeDhWidget *widget)
{
GList *hbuttons = NULL;
GladeDhWidgetPriv *priv;
g_return_val_if_fail (GLADE_IS_DHWIDGET (widget), NULL);
priv = widget->priv;
hbuttons = g_list_prepend (hbuttons, priv->html_button);
hbuttons = g_list_prepend (hbuttons, priv->search_button);
hbuttons = g_list_prepend (hbuttons, priv->forward);
hbuttons = g_list_prepend (hbuttons, priv->back);
return hbuttons;
}
#ifdef SCAFFOLD
......
......@@ -28,6 +28,7 @@ struct _GladeDhWidgetClass {
GType glade_dh_widget_get_type (void) G_GNUC_CONST;
GtkWidget * glade_dh_widget_new (void);
GList * glade_dh_get_hbuttons (GladeDhWidget *widget);
void glade_dh_widget_search (GladeDhWidget *widget,
const gchar *str);
......
......@@ -266,7 +266,7 @@ glade_editor_create_info_button (void)
button = gtk_button_new ();
hbox = gtk_hbox_new (FALSE, 0);
label = gtk_label_new_with_mnemonic ("_Documentation");
label = gtk_label_new_with_mnemonic (_("_Documentation"));
image = gtk_image_new_from_file (path);
align = gtk_alignment_new (0.5, 0.5, 0, 0);
......@@ -493,8 +493,10 @@ glade_editor_table_append_name_field (GladeEditorTable *table)
/* Name */
label = gtk_label_new (_("Name :"));
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
gtk_widget_show (label);
table->name_entry = gtk_entry_new ();
gtk_widget_show (table->name_entry);
g_signal_connect (G_OBJECT (table->name_entry), "activate",
G_CALLBACK (glade_editor_widget_name_changed),
......@@ -522,6 +524,9 @@ glade_editor_table_append_class_field (GladeEditorTable *table)
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.0);
gtk_misc_set_alignment (GTK_MISC (class_label), 0.0, 0.0);
gtk_widget_show (label);
gtk_widget_show (class_label);
glade_editor_table_attach (table->table_widget, label, 0, table->rows);
glade_editor_table_attach (table->table_widget, class_label, 1, table->rows);
......@@ -694,7 +699,8 @@ glade_editor_load_page (GladeEditor *editor,
void
glade_editor_update_widget_name (GladeEditor *editor)
{
GladeEditorTable *table = glade_editor_get_table_from_class (editor, editor->loaded_class, FALSE);
GladeEditorTable *table = glade_editor_get_table_from_class
(editor, editor->loaded_class, TABLE_TYPE_GENERAL);
g_signal_handlers_block_by_func (G_OBJECT (table->name_entry), glade_editor_widget_name_changed, editor);
gtk_entry_set_text (GTK_ENTRY (table->name_entry), editor->loaded_widget->name);
......
......@@ -66,6 +66,9 @@ struct _GladeProjectWindowPriv {
GtkWindow *editor_window; /* The window that will contain the editor */
GtkWidget *devhelp; /* The embedded devhelp widget */
GtkWidget *devhelp_paned; /* A handle to control the devhelp paned window. */
GtkWidget *expand; /* Expand/Collapse the treeview */
GtkWidget *collapse;
};
#define WINDOW_TITLE (_("Glade-3 GUI Builder"))
......@@ -141,10 +144,10 @@ gpw_recent_project_add (GladeProjectWindow *gpw, const gchar *project_path)
guint merge_id;
/* Need to check if it's already loaded */
if ((action = g_queue_find_custom (gpw->priv->recent_projects,
project_path, gpw_rp_cmp)))
gpw_recent_project_delete (action, gpw);
if (g_queue_find_custom (gpw->priv->recent_projects,
project_path, gpw_rp_cmp))
return;
label = glade_util_duplicate_underscores (project_path);
if (!label) return;
......@@ -1083,7 +1086,7 @@ gpw_expand_treeview (GtkButton *button, GtkTreeView *tree)
static GtkWidget*
gpw_create_widget_tree_contents (GladeProjectWindow *gpw)
{
GtkWidget *hbox, *vbox, *expand, *collapse;
GtkWidget *hbox, *vbox;
GladeProjectView *view;
view = glade_project_view_new (GLADE_PROJECT_VIEW_TREE);
......@@ -1102,25 +1105,24 @@ gpw_create_widget_tree_contents (GladeProjectWindow *gpw)
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_START);
expand = gtk_button_new_with_mnemonic (_("E_xpand all"));
gtk_container_set_border_width (GTK_CONTAINER (expand),
gpw->priv->expand = gtk_button_new_with_mnemonic (_("E_xpand all"));
gtk_container_set_border_width (GTK_CONTAINER (gpw->priv->expand),
GLADE_GENERIC_BORDER_WIDTH);
collapse = gtk_button_new_with_mnemonic (_("_Collapse all"));
gtk_container_set_border_width (GTK_CONTAINER (collapse),
gpw->priv->collapse = gtk_button_new_with_mnemonic (_("_Collapse all"));
gtk_container_set_border_width (GTK_CONTAINER (gpw->priv->collapse),
GLADE_GENERIC_BORDER_WIDTH);
gtk_box_pack_start (GTK_BOX (hbox), expand, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), collapse, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gpw->priv->expand, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gpw->priv->collapse, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (view), TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (expand), "clicked",
g_signal_connect (G_OBJECT (gpw->priv->expand), "clicked",
G_CALLBACK (gpw_expand_treeview),
view->tree_view);
g_signal_connect_swapped (G_OBJECT (collapse), "clicked",
g_signal_connect_swapped (G_OBJECT (gpw->priv->collapse), "clicked",
G_CALLBACK (gtk_tree_view_collapse_all),
view->tree_view);
......@@ -1678,6 +1680,10 @@ glade_project_window_create (GladeProjectWindow *gpw)
if ((gpw->priv->devhelp = glade_util_load_devhelp ()) != NULL)
{
GtkSizeGroup *group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
GList *devhelp_buttons, *list;
gpw->priv->devhelp_paned = gtk_hpaned_new();
gtk_paned_add1 (GTK_PANED (gpw->priv->devhelp_paned),
project_view);
......@@ -1687,6 +1693,14 @@ glade_project_window_create (GladeProjectWindow *gpw)
gtk_box_pack_start (GTK_BOX (vbox), gpw->priv->devhelp_paned,
TRUE, TRUE, 0);
devhelp_buttons = glade_util_get_hbuttons (gpw->priv->devhelp);
for (list = devhelp_buttons; list; list = list->next)
gtk_size_group_add_widget (group, GTK_WIDGET (list->data));
gtk_size_group_add_widget (group, gpw->priv->expand);
gtk_size_group_add_widget (group, gpw->priv->collapse);
g_list_free (devhelp_buttons);
g_idle_add ((GSourceFunc)initiate_devhelp_search, gpw);
}
else
......
......@@ -1613,7 +1613,8 @@ glade_util_file_is_writeable (const gchar *path)
*/
static GModule *devhelp_mod = NULL;
static GtkWidget *(* glade_dh_widget_new) (void) = NULL;
static void (* glade_dh_widget_search) (GtkWidget *, const gchar *) = NULL;
static GList *(* glade_dh_get_hbuttons) (GtkWidget *) = NULL;
static void (* glade_dh_widget_search) (GtkWidget *, const gchar *) = NULL;
/**
* glade_util_load_devhelp:
......@@ -1661,6 +1662,19 @@ glade_util_load_devhelp (void)
devhelp_mod = NULL;
return NULL;
}
if (!g_module_symbol (devhelp_mod,
"glade_dh_get_hbuttons",
(gpointer)&glade_dh_get_hbuttons))
{
g_critical ("Failed to load 'glade_dh_get_hbuttons' "
"symbol from the devhelp module (%s)",
g_module_error ());
g_module_close (devhelp_mod);
devhelp_mod = NULL;
return NULL;
}
/* Load the widget */
widget = glade_dh_widget_new ();
......@@ -1671,6 +1685,25 @@ glade_util_load_devhelp (void)
return widget;
}
/**
* glade_util_have_devhelp:
* @widget: The devhelp widget
*
* Used to align the buttons with the expand/colapse buttons
*
* Returns: a list of buttons in the hbox
*/
GList *
glade_util_get_hbuttons (GtkWidget *devhelp)
{
g_return_if_fail (glade_util_have_devhelp ());
return glade_dh_get_hbuttons (devhelp);
}
/**
* glade_util_have_devhelp:
*
......
......@@ -142,6 +142,8 @@ void glade_util_search_devhelp (GtkWidget *devhelp,
const gchar *book,
const gchar *page,
const gchar *search);
LIBGLADEUI_API
GList *glade_util_get_hbuttons (GtkWidget *devhelp);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment