aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog8
-rw-r--r--shell/e-user-creatable-items-handler.c81
-rw-r--r--widgets/misc/ChangeLog10
-rw-r--r--widgets/misc/e-combo-button.c67
-rw-r--r--widgets/misc/e-combo-button.h2
5 files changed, 157 insertions, 11 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 77b64db9f8..378718b44f 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-19 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fixes bug #252814
+
+ * e-user-creatable-items-handler.c: (new_button_change),
+ (setup_toolbar_button), (e_user_creatable_items_handler_activate):
+ Read the toolbar setting and set the combo button. Patch from Oswald.
+
2006-06-17 Andre Klapper <a9016009@gmx.de>
* main.c: update last stable version number from 2.6.1 to 2.6.2
diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c
index 159c5b47b0..80aef0fb44 100644
--- a/shell/e-user-creatable-items-handler.c
+++ b/shell/e-user-creatable-items-handler.c
@@ -50,6 +50,9 @@
#include <ctype.h>
#include <string.h>
+#include <gconf/gconf-client.h>
+#include <libgnome/gnome-gconf.h>
+
struct _Component {
char *id, *alias;
GNOME_Evolution_Component component;
@@ -668,11 +671,53 @@ gtk_separator_func (EUserCreatableItemsHandler *handler, gpointer menu, int nth)
}
static void
+new_button_change (GConfClient *gconf,
+ unsigned int connection_id,
+ GConfEntry *entry,
+ EUserCreatableItemsHandler *handler)
+{
+ EUserCreatableItemsHandlerPrivate *priv;
+ char *val;
+
+ priv = handler->priv;
+ val = gconf_client_get_string (gconf, "/desktop/gnome/interface/toolbar_style", NULL);
+
+ if(!g_ascii_strcasecmp (val,"both")){
+ e_combo_button_pack_vbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _(" New "));
+ }
+ else if(!g_ascii_strcasecmp (val,"both-horiz")){
+ e_combo_button_pack_hbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _("New"));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ }
+ else if(!g_ascii_strcasecmp (val,"icons")){
+ e_combo_button_pack_hbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button),_(""));
+ }
+ else if(!g_ascii_strcasecmp(val,"text")){
+ e_combo_button_pack_hbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _("New"));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ NULL);
+ }
+ gtk_widget_show (priv->new_button);
+}
+
+static void
setup_toolbar_button (EUserCreatableItemsHandler *handler)
{
EUserCreatableItemsHandlerPrivate *priv;
+ GConfClient *gconf = gconf_client_get_default ();
+ char *val;
priv = handler->priv;
+ val = gconf_client_get_string (gconf, "/desktop/gnome/interface/toolbar_style", NULL);
priv->new_button = e_combo_button_new ();
priv->new_menu = gtk_menu_new ();
@@ -682,9 +727,7 @@ setup_toolbar_button (EUserCreatableItemsHandler *handler)
gtk_widget_show_all (priv->new_menu);
e_combo_button_set_menu (E_COMBO_BUTTON (priv->new_button),
GTK_MENU (priv->new_menu));
- e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _("New"));
- gtk_widget_show (priv->new_button);
-
+
g_signal_connect (priv->new_button, "activate_default",
G_CALLBACK (default_activate), handler);
@@ -697,10 +740,36 @@ setup_toolbar_button (EUserCreatableItemsHandler *handler)
}
gtk_widget_set_sensitive (priv->new_button, TRUE);
+
+ if(!g_ascii_strcasecmp (val,"both")){
+ e_combo_button_pack_vbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _(" New "));
+ }
+ else if(!g_ascii_strcasecmp (val,"both-horiz")){
+ e_combo_button_pack_hbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _("New"));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ }
+ else if(!g_ascii_strcasecmp (val,"icons")){
+ e_combo_button_pack_vbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ priv->default_menu_item->icon);
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), NULL);
+ }
+ else if(!g_ascii_strcasecmp(val,"text")){
+ e_combo_button_pack_hbox (E_COMBO_BUTTON (priv->new_button));
+ e_combo_button_set_label (E_COMBO_BUTTON (priv->new_button), _("New"));
+ e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
+ NULL);
+ }
- e_combo_button_set_icon (E_COMBO_BUTTON (priv->new_button),
- priv->default_menu_item->icon);
+ gconf_client_notify_add(gconf,"/desktop/gnome/interface/toolbar_style",
+ (GConfClientNotifyFunc)new_button_change, handler, NULL, NULL);
+ gtk_widget_show (priv->new_button);
priv->tooltips = gtk_tooltips_new ();
gtk_object_ref (GTK_OBJECT (priv->tooltips));
gtk_object_sink (GTK_OBJECT (priv->tooltips));
@@ -863,5 +932,3 @@ e_user_creatable_items_handler_activate (EUserCreatableItemsHandler *handler,
BONOBO_OBJREF (priv->new_control),
NULL);
}
-
-
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 3655f14352..1699117f56 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,13 @@
+2006-06-19 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fixes bug #252814
+ Committing a patch from Oswald.
+
+ * e-combo-button.c: (e_combo_button_init),
+ (e_combo_button_pack_hbox), (e_combo_button_pack_vbox):
+ * e-combo-button.h: Adds new packing support for supporting toolbar
+ options.
+
2006-06-19 Chpe <chpe@gnome.org>
* e-combo-button.c: (paint): Fix for bug #262210
diff --git a/widgets/misc/e-combo-button.c b/widgets/misc/e-combo-button.c
index 53dded883a..1986c594fc 100644
--- a/widgets/misc/e-combo-button.c
+++ b/widgets/misc/e-combo-button.c
@@ -30,6 +30,7 @@
#include <gtk/gtkarrow.h>
#include <gtk/gtkhbox.h>
+#include <gtk/gtkvbox.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkimage.h>
@@ -42,10 +43,12 @@ struct _EComboButtonPrivate {
GtkWidget *label;
GtkWidget *arrow_image;
GtkWidget *hbox;
+ GtkWidget *vbox;
GtkMenu *menu;
gboolean menu_popped_up;
+ gboolean is_already_packed;
};
#define SPACING 2
@@ -437,6 +440,23 @@ e_combo_button_init (EComboButton *combo_button)
priv = g_new (EComboButtonPrivate, 1);
combo_button->priv = priv;
+
+ priv->icon = NULL;
+ priv->menu = NULL;
+ priv->menu_popped_up = FALSE;
+ priv->is_already_packed = FALSE;
+}
+
+void
+e_combo_button_pack_hbox (EComboButton *combo_button)
+{
+ EComboButtonPrivate *priv;
+
+ priv = combo_button->priv;
+
+ if(priv->is_already_packed){
+ gtk_widget_destroy (priv->hbox);
+ }
priv->hbox = gtk_hbox_new (FALSE, SPACING);
gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
@@ -448,17 +468,56 @@ e_combo_button_init (EComboButton *combo_button)
priv->label = gtk_label_new ("");
gtk_box_pack_start (GTK_BOX (priv->hbox), priv->label, TRUE, TRUE,
- 2 * GTK_WIDGET (combo_button)->style->xthickness);
+ 0);
gtk_widget_show (priv->label);
priv->arrow_image = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
gtk_box_pack_end (GTK_BOX (priv->hbox), priv->arrow_image, TRUE, TRUE,
GTK_WIDGET (combo_button)->style->xthickness);
gtk_widget_show (priv->arrow_image);
+
+ gtk_widget_show (priv->hbox);
+
+ priv->is_already_packed = TRUE;
+}
- priv->icon = NULL;
- priv->menu = NULL;
- priv->menu_popped_up = FALSE;
+void
+e_combo_button_pack_vbox (EComboButton *combo_button)
+{
+ EComboButtonPrivate *priv;
+
+ priv = combo_button->priv;
+
+ if(priv->is_already_packed){
+ gtk_widget_destroy (priv->hbox);
+ }
+
+ priv->hbox = gtk_hbox_new (FALSE, SPACING);
+ gtk_container_add (GTK_CONTAINER (combo_button), priv->hbox);
+ gtk_widget_show (priv->hbox);
+
+ priv->vbox = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (priv->vbox);
+
+ priv->icon_image = e_icon_factory_get_image (NULL, E_ICON_SIZE_MENU);
+ gtk_box_pack_start (GTK_BOX (priv->vbox), priv->icon_image, TRUE, TRUE, 0);
+ gtk_widget_show (priv->icon_image);
+
+ priv->label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (priv->vbox), priv->label, TRUE, TRUE,
+ 0);
+ gtk_widget_show (priv->label);
+
+ gtk_box_pack_start (GTK_BOX(priv->hbox),priv->vbox, TRUE, TRUE, 0);
+
+ priv->arrow_image = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+ gtk_box_pack_end (GTK_BOX (priv->hbox), priv->arrow_image, TRUE, TRUE,
+ GTK_WIDGET (combo_button)->style->xthickness);
+ gtk_widget_show (priv->arrow_image);
+
+ gtk_widget_show (priv->hbox);
+
+ priv->is_already_packed = TRUE;
}
diff --git a/widgets/misc/e-combo-button.h b/widgets/misc/e-combo-button.h
index f7d5b878de..dac02c035f 100644
--- a/widgets/misc/e-combo-button.h
+++ b/widgets/misc/e-combo-button.h
@@ -72,6 +72,8 @@ void e_combo_button_set_label (EComboButton *combo_button,
const char *label);
void e_combo_button_set_menu (EComboButton *combo_button,
GtkMenu *menu);
+void e_combo_button_pack_vbox (EComboButton *combo_button);
+void e_combo_button_pack_hbox (EComboButton *combo_button);
GtkWidget *e_combo_button_get_label (EComboButton *combo_button);