diff options
author | Paolo Maggi <maggi@athena.polito.it> | 2002-10-17 08:18:23 +0000 |
---|---|---|
committer | Paolo Maggi <paolo@src.gnome.org> | 2002-10-17 08:18:23 +0000 |
commit | 614c1848f0e3bec2d8a6a3595772f27e3e7a0a06 (patch) | |
tree | e3447469ca3ecf5ba9715a361c7ab495a332973b | |
parent | 0b0550b464806a09c7a51b67c76bbeeefb29f8c3 (diff) | |
download | yelp-614c1848f0e3bec2d8a6a3595772f27e3e7a0a06.tar.gz |
YelpWindow is now inherited from GnomeApp. The window title is now "title
2002-10-08 Paolo Maggi <maggi@athena.polito.it>
* src/yelp-window.[ch]: YelpWindow is now inherited from GnomeApp.
The window title is now "title - Help Browser", instead of
"Help Browser:title", in this way you can see in the tasklist applet
the name of the loaded page.
Removed the gconf stuff since is no more needed.
Note that Yelp still does not monitor menus_have_icons gconf key
* src/yelp-view-content.c (content_show_uri): set the loading page
title to "Loading...", instead of ".."
* src/yelp-view-index.c (index_show_uri): ditto
(set_relation): removed since no more needed
(yelp_view_index_new): add an accellerator to "Search for:"
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | src/yelp-view-content.c | 11 | ||||
-rw-r--r-- | src/yelp-view-index.c | 55 | ||||
-rw-r--r-- | src/yelp-window.c | 88 | ||||
-rw-r--r-- | src/yelp-window.h | 6 |
5 files changed, 51 insertions, 125 deletions
@@ -1,3 +1,19 @@ +2002-10-08 Paolo Maggi <maggi@athena.polito.it> + + * src/yelp-window.[ch]: YelpWindow is now inherited from GnomeApp. + The window title is now "title - Help Browser", instead of + "Help Browser:title", in this way you can see in the tasklist applet + the name of the loaded page. + Removed the gconf stuff since is no more needed. + Note that Yelp still does not monitor menus_have_icons gconf key + + * src/yelp-view-content.c (content_show_uri): set the loading page + title to "Loading...", instead of ".." + + * src/yelp-view-index.c (index_show_uri): ditto + (set_relation): removed since no more needed + (yelp_view_index_new): add an accellerator to "Search for:" + 2002-10-04 Marius Andreiana <mandreiana@yahoo.com> * stylesheets/yelp-customization.xsl: made translatable the diff --git a/src/yelp-view-content.c b/src/yelp-view-content.c index c1634a2b..1624ee57 100644 --- a/src/yelp-view-content.c +++ b/src/yelp-view-content.c @@ -497,10 +497,15 @@ content_show_uri (YelpView *view, YelpURI *uri, GError **error) gchar *loading = _("Loading..."); yelp_html_clear (priv->html_view); - + yelp_html_printf (priv->html_view, - "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><title>..</title><body><center>%s</center></body></html>", - loading); + "<html><meta http-equiv=\"Content-Type\" " + "content=\"text/html; charset=utf-8\">" + "<title>%s</title>" + "<body><center>%s</center></body>" + "</html>", + loading, loading); + yelp_html_close (priv->html_view); } } diff --git a/src/yelp-view-index.c b/src/yelp-view-index.c index 7c4797de..6cd33c91 100644 --- a/src/yelp-view-index.c +++ b/src/yelp-view-index.c @@ -69,8 +69,7 @@ static gboolean index_filter_idle (YelpViewIndex *view); static gchar * index_complete_func (YelpSection *section); -static void set_relation (GtkWidget *widget, - GtkLabel *label); + static void index_reader_data_cb (YelpReader *reader, const gchar *data, gint len, @@ -342,43 +341,6 @@ index_complete_func (YelpSection *section) return section->name; } -/** - * set_relation - * @widget : The Gtk widget which is labelled by @label - * @label : The label for the @widget. - * Description : This function establishes atk relation - * between a gtk widget and a label. - */ - -static void -set_relation (GtkWidget *widget, GtkLabel *label) -{ - AtkObject *aobject; - AtkRelationSet *relation_set; - AtkRelation *relation; - AtkObject *targets[1]; - - g_return_if_fail (GTK_IS_WIDGET (widget)); - g_return_if_fail (GTK_IS_LABEL (label)); - - aobject = gtk_widget_get_accessible (widget); - - /* Return if GAIL is not loaded */ - if (! GTK_IS_ACCESSIBLE (aobject)) { - return; - } - - /* Set the ATK_RELATION_LABEL_FOR relation */ - gtk_label_set_mnemonic_widget (label, widget); - - targets[0] = gtk_widget_get_accessible (GTK_WIDGET (label)); - - relation_set = atk_object_ref_relation_set (aobject); - - relation = atk_relation_new (targets, 1, ATK_RELATION_LABELLED_BY); - atk_relation_set_add (relation_set, relation); - g_object_unref (G_OBJECT (relation)); -} static void index_reader_data_cb (YelpReader *reader, @@ -452,10 +414,15 @@ index_show_uri (YelpView *view, YelpURI *index_uri, GError **error) gchar *loading = _("Loading..."); yelp_html_clear (priv->html_view); - + yelp_html_printf (priv->html_view, - "<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><title>..</title><body><center>%s</center></body></html>", - loading); + "<html><meta http-equiv=\"Content-Type\" " + "content=\"text/html; charset=utf-8\">" + "<title>%s</title>" + "<body><center>%s</center></body>" + "</html>", + loading, loading); + yelp_html_close (priv->html_view); } @@ -487,13 +454,13 @@ yelp_view_index_new (GList *index) hbox = gtk_hbox_new (FALSE, 0); - label = gtk_label_new (_("Search for:")); + label = gtk_label_new_with_mnemonic (_("_Search for:")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4); priv->entry = gtk_entry_new (); - set_relation (priv->entry, GTK_LABEL (label)); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->entry); g_signal_connect (priv->entry, "changed", G_CALLBACK (index_entry_changed_cb), diff --git a/src/yelp-window.c b/src/yelp-window.c index 511fdb6e..e9f30dfe 100644 --- a/src/yelp-window.c +++ b/src/yelp-window.c @@ -27,7 +27,6 @@ #include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtk.h> #include <bonobo/bonobo-main.h> -#include <gconf/gconf-client.h> #include <libgnomevfs/gnome-vfs.h> #include <libgnomeui/gnome-about.h> #include <libgnomeui/gnome-stock-icons.h> @@ -52,12 +51,6 @@ typedef enum { YELP_WINDOW_ACTION_FORWARD } YelpHistoryAction; -static GConfEnumStringPair toolbar_styles[] = { - { GTK_TOOLBAR_TEXT, "text" }, - { GTK_TOOLBAR_ICONS, "icons" }, - { GTK_TOOLBAR_BOTH, "both" }, - { GTK_TOOLBAR_BOTH_HORIZ, "both_horiz" } -}; static void window_init (YelpWindow *window); static void window_class_init (YelpWindowClass *klass); @@ -113,13 +106,6 @@ static GtkWidget * window_create_toolbar (YelpWindow *window); static GdkPixbuf * window_load_icon (void); -static void -window_toolbar_style_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer data); - - enum { @@ -187,7 +173,7 @@ yelp_window_get_type (void) (GInstanceInitFunc) window_init, }; - window_type = g_type_register_static (GTK_TYPE_WINDOW, + window_type = g_type_register_static (GNOME_TYPE_APP, "YelpWindow", &window_info, 0); } @@ -254,8 +240,8 @@ window_populate (YelpWindow *window) main_box = gtk_vbox_new (FALSE, 0); - gtk_container_add (GTK_CONTAINER (window), main_box); - + gnome_app_set_contents (GNOME_APP (window), main_box); + accel_group = gtk_accel_group_new (); priv->item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group); @@ -279,13 +265,13 @@ window_populate (YelpWindow *window) YELP_WINDOW_ACTION_FORWARD); gtk_widget_set_sensitive (menu_item, FALSE); - gtk_box_pack_start (GTK_BOX (main_box), - gtk_item_factory_get_widget (priv->item_factory, - "<main>"), - FALSE, FALSE, 0); + gnome_app_set_menus (GNOME_APP (window), GTK_MENU_BAR ( + gtk_item_factory_get_widget (priv->item_factory, "<main>"))); - toolbar = window_create_toolbar (window); + toolbar = window_create_toolbar (window); + gnome_app_set_toolbar (GNOME_APP (window), GTK_TOOLBAR (toolbar)); + priv->notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE); @@ -313,9 +299,10 @@ window_populate (YelpWindow *window) NULL, PAGE_INDEX_VIEW); } - gtk_box_pack_start (GTK_BOX (main_box), toolbar, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (main_box), priv->notebook, TRUE, TRUE, 0); + + gtk_widget_grab_focus (priv->content_view->widget); } static gboolean @@ -422,7 +409,7 @@ window_title_changed_cb (gpointer view, const gchar *title, YelpWindow *window) g_return_if_fail (title != NULL); g_return_if_fail (YELP_IS_WINDOW (window)); - new_title = g_strconcat (_("Help Browser"), ":", title, NULL); + new_title = g_strconcat (title, " - ", _("Help Browser"), NULL); gtk_window_set_title (GTK_WINDOW (window), new_title); @@ -612,40 +599,13 @@ window_create_toolbar (YelpWindow *window) GtkWidget *toolbar; GtkWidget *button; GtkWidget *icon; - GConfClient *conf_client; - gchar *str; - GtkToolbarStyle style = GTK_TOOLBAR_BOTH; g_return_val_if_fail (YELP_IS_WINDOW (window), NULL); priv = window->priv; toolbar = gtk_toolbar_new (); - - conf_client = gconf_client_get_default (); - str = gconf_client_get_string (conf_client, - "/desktop/gnome/interface/toolbar_style", - NULL); - - if (str) { - gconf_string_to_enum (toolbar_styles, - str, - (gint*)&style); - g_free (str); - } - - gconf_client_notify_add (conf_client, - "/desktop/gnome/interface/toolbar_style", - window_toolbar_style_changed_cb, - toolbar, NULL, NULL); - -/* g_signal_connect(toolbar, "destroy", */ -/* G_CALLBACK(window_remove_notify_cb), */ -/* GINT_TO_POINTER(notify_id)); */ - - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), style); - icon = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_LARGE_TOOLBAR); @@ -722,29 +682,6 @@ window_load_icon (void) return pixbuf; } -static void -window_toolbar_style_changed_cb (GConfClient *client, - guint cnxn_id, - GConfEntry *entry, - gpointer data) -{ - GtkToolbarStyle style = GTK_TOOLBAR_BOTH; - GtkToolbar *toolbar = GTK_TOOLBAR(data); - GConfValue *value; - - value = gconf_entry_get_value (entry); - - /* If no per-app setting use this new global setting */ - if (value && - value->type == GCONF_VALUE_STRING && - gconf_value_get_string (value) != NULL) { - gconf_string_to_enum(toolbar_styles, - gconf_value_get_string(value), - (gint*)&style); - } - - gtk_toolbar_set_style(toolbar, style); -} GtkWidget * yelp_window_new (GNode *doc_tree, GList *index) @@ -752,7 +689,8 @@ yelp_window_new (GNode *doc_tree, GList *index) YelpWindow *window; YelpWindowPriv *priv; - window = g_object_new (YELP_TYPE_WINDOW, NULL); + window = g_object_new (YELP_TYPE_WINDOW, + "app_id", PACKAGE, NULL); priv = window->priv; priv->doc_tree = doc_tree; diff --git a/src/yelp-window.h b/src/yelp-window.h index bcab1ece..709b86d9 100644 --- a/src/yelp-window.h +++ b/src/yelp-window.h @@ -23,7 +23,7 @@ #ifndef __YELP_WINDOW_H__ #define __YELP_WINDOW_H__ -#include <gtk/gtkwindow.h> +#include <libgnomeui/gnome-app.h> #include <gtk/gtktreemodel.h> #include "yelp-base.h" @@ -41,14 +41,14 @@ typedef struct _YelpWindowPriv YelpWindowPriv; struct _YelpWindow { - GtkWindow parent; + GnomeApp parent; YelpWindowPriv *priv; }; struct _YelpWindowClass { - GtkWindowClass parent_class; + GnomeAppClass parent_class; /* Signals */ void (*new_window_requested) (YelpWindow *window); |