summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-09 01:26:19 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2006-08-09 01:26:19 +0000
commit95a600525148564d98a0c26f1c7fe9d8b6ecc7a5 (patch)
tree81a5cb58ede7706a4ce1f564b48f670fe399f5c5
parent4d0f7706aebe3f1a3fd8623fc819ea637e6ef6b7 (diff)
downloadmdk-95a600525148564d98a0c26f1c7fe9d8b6ecc7a5.tar.gz
mdk-95a600525148564d98a0c26f1c7fe9d8b6ecc7a5.tar.bz2
Configurable toolbars (icons, text or both)
git-archimport-id: mdk@sv.gnu.org/mdk--devel--1--patch-36
-rw-r--r--mixgtk/mixgtk.glade132
-rw-r--r--mixgtk/mixgtk_config.c26
-rw-r--r--mixgtk/mixgtk_config.h7
-rw-r--r--mixgtk/mixgtk_wm.c49
4 files changed, 180 insertions, 34 deletions
diff --git a/mixgtk/mixgtk.glade b/mixgtk/mixgtk.glade
index 1de46eb..434d171 100644
--- a/mixgtk/mixgtk.glade
+++ b/mixgtk/mixgtk.glade
@@ -53,7 +53,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image432">
+ <widget class="GtkImage" id="image504">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -76,7 +76,7 @@
<accelerator key="E" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image433">
+ <widget class="GtkImage" id="image505">
<property name="visible">True</property>
<property name="stock">gtk-justify-fill</property>
<property name="icon_size">1</property>
@@ -99,7 +99,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image434">
+ <widget class="GtkImage" id="image506">
<property name="visible">True</property>
<property name="stock">gtk-execute</property>
<property name="icon_size">1</property>
@@ -128,7 +128,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image435">
+ <widget class="GtkImage" id="image507">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@@ -164,7 +164,7 @@
<accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image436">
+ <widget class="GtkImage" id="image508">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property>
@@ -187,7 +187,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image437">
+ <widget class="GtkImage" id="image509">
<property name="visible">True</property>
<property name="stock">gtk-goto-last</property>
<property name="icon_size">1</property>
@@ -210,7 +210,7 @@
<accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image438">
+ <widget class="GtkImage" id="image510">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
@@ -233,7 +233,7 @@
<accelerator key="Y" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image439">
+ <widget class="GtkImage" id="image511">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@@ -260,22 +260,102 @@
<widget class="GtkMenu" id="view1_menu">
<child>
- <widget class="GtkCheckMenuItem" id="show_toolbars">
+ <widget class="GtkImageMenuItem" id="toolbars1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Toolbars</property>
<property name="use_underline">True</property>
- <property name="active">False</property>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image512">
+ <property name="visible">True</property>
+ <property name="stock">gtk-preferences</property>
+ <property name="icon_size">1</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenu" id="toolbars1_menu">
+
+ <child>
+ <widget class="GtkCheckMenuItem" id="show_toolbars">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Show Toolbars</property>
+ <property name="use_underline">True</property>
+ <property name="active">False</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkMenuItem" id="toolbars_style">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Style</property>
+ <property name="use_underline">True</property>
+
+ <child>
+ <widget class="GtkMenu" id="toolbars_style_menu">
+
+ <child>
+ <widget class="GtkRadioMenuItem" id="tb_style_icons">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Show only icons in toolbar buttons</property>
+ <property name="label" translatable="yes">_Icons</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkRadioMenuItem" id="tb_style_labels">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Show only labels in toolbar buttons</property>
+ <property name="label" translatable="yes">_Labels</property>
+ <property name="use_underline">True</property>
+ <property name="active">False</property>
+ <property name="group">tb_style_icons</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkRadioMenuItem" id="tb_style_both">
+ <property name="visible">True</property>
+ <property name="tooltip" translatable="yes">Show both icons and labels in toolbar buttons</property>
+ <property name="label" translatable="yes">_Both</property>
+ <property name="use_underline">True</property>
+ <property name="active">False</property>
+ <property name="group">tb_style_icons</property>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkRadioMenuItem" id="tb_style_bothh">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Sideways</property>
+ <property name="use_underline">True</property>
+ <property name="active">False</property>
+ <property name="group">tb_style_icons</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
</child>
<child>
- <widget class="GtkImageMenuItem" id=" ">
+ <widget class="GtkImageMenuItem" id=" detached_windows">
<property name="visible">True</property>
<property name="label" translatable="yes">_Detached windows</property>
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image440">
+ <widget class="GtkImage" id="image513">
<property name="visible">True</property>
<property name="stock">gtk-dnd-multiple</property>
<property name="icon_size">1</property>
@@ -287,7 +367,7 @@
</child>
<child>
- <widget class="GtkMenu" id=" _menu">
+ <widget class="GtkMenu" id=" detached_windows_menu">
<child>
<widget class="GtkCheckMenuItem" id="detach_vm">
@@ -340,7 +420,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image441">
+ <widget class="GtkImage" id="image514">
<property name="visible">True</property>
<property name="stock">gtk-select-font</property>
<property name="icon_size">1</property>
@@ -437,7 +517,7 @@
<signal name="activate" handler="on_devform_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image442">
+ <widget class="GtkImage" id="image515">
<property name="visible">True</property>
<property name="stock">gtk-zoom-100</property>
<property name="icon_size">1</property>
@@ -458,7 +538,7 @@
<signal name="activate" handler="on_devdir_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image443">
+ <widget class="GtkImage" id="image516">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@@ -479,7 +559,7 @@
<signal name="activate" handler="on_external_programs_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image444">
+ <widget class="GtkImage" id="image517">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@@ -507,7 +587,7 @@
<signal name="activate" handler="on_save_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image445">
+ <widget class="GtkImage" id="image518">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@@ -552,7 +632,7 @@
<signal name="activate" handler="on_about_activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image446">
+ <widget class="GtkImage" id="image519">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@@ -819,7 +899,7 @@
<widget class="GtkToolButton" id="attach_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Attach all windows</property>
- <property name="label" translatable="yes"></property>
+ <property name="label" translatable="yes">Attach</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-dnd</property>
<property name="visible_horizontal">True</property>
@@ -2134,7 +2214,7 @@ disk7</property>
<property name="snap_edge">GTK_POS_TOP</property>
<child>
- <widget class="GtkToolbar" id="mixal_toolbar">
+ <widget class="GtkToolbar" id="dlg_toolbar">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_default">True</property>
@@ -2263,7 +2343,7 @@ disk7</property>
<widget class="GtkToolButton" id="attach_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Attach window</property>
- <property name="label" translatable="yes"></property>
+ <property name="label" translatable="yes">Attach</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-dnd</property>
<property name="visible_horizontal">True</property>
@@ -2351,7 +2431,7 @@ disk7</property>
<property name="snap_edge">GTK_POS_TOP</property>
<child>
- <widget class="GtkToolbar" id="devices_toolbar">
+ <widget class="GtkToolbar" id="dlg_toolbar">
<property name="border_width">2</property>
<property name="visible">True</property>
<property name="can_default">True</property>
@@ -2444,7 +2524,7 @@ disk7</property>
<widget class="GtkToolButton" id="attach_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Attach window</property>
- <property name="label" translatable="yes"></property>
+ <property name="label" translatable="yes">Attach</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-dnd</property>
<property name="visible_horizontal">True</property>
@@ -2661,7 +2741,7 @@ disk7</property>
<property name="snap_edge">GTK_POS_TOP</property>
<child>
- <widget class="GtkToolbar" id="mixvm_toolbar">
+ <widget class="GtkToolbar" id="dlg_toolbar">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
@@ -2704,7 +2784,7 @@ disk7</property>
<widget class="GtkToolButton" id="attach_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Attach window</property>
- <property name="label" translatable="yes"></property>
+ <property name="label" translatable="yes">Attach</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-dnd</property>
<property name="visible_horizontal">True</property>
diff --git a/mixgtk/mixgtk_config.c b/mixgtk/mixgtk_config.c
index 519e3cb..81cebac 100644
--- a/mixgtk/mixgtk_config.c
+++ b/mixgtk/mixgtk_config.c
@@ -30,9 +30,10 @@
#include "mixgtk_config.h"
static const gchar *MIXGTK_CONFIG_FILE_ = "gmixvm.config";
-static const gchar *SHOW_TB_KEY = "Toolbars";
-static const gchar *TB_YES = "Yes";
-static const gchar *TB_NO = "No";
+static const gchar *SHOW_TB_KEY_ = "Toolbars";
+static const gchar *TB_YES_ = "Yes";
+static const gchar *TB_NO_ = "No";
+static const gchar *TB_STYLE_KEY_ = "ToolbarStyle";
static mix_config_t *config_ = NULL;
@@ -47,6 +48,7 @@ mixgtk_config_load (void)
config_ = mix_config_new (cdir, MIXGTK_CONFIG_FILE_);
g_free (cdir);
}
+
return (config_ != NULL);
}
@@ -70,6 +72,18 @@ mixgtk_config_set_autosave (gboolean autosave)
mix_config_set_autosave (config_, autosave);
}
+guint
+mixgtk_config_tb_style (void)
+{
+ return (guint)mix_config_get_integer (config_, TB_STYLE_KEY_);
+}
+
+void
+mixgtk_config_set_tb_style (guint style)
+{
+ mix_config_update_integer (config_, TB_STYLE_KEY_, (gint)style);
+}
+
/* update config item */
void
mixgtk_config_update (const gchar *key, const gchar *value)
@@ -100,12 +114,12 @@ mixgtk_config_save (void)
gboolean
mixgtk_config_show_toolbars (void)
{
- const gchar *show = mixgtk_config_get (SHOW_TB_KEY);
- return (!show || !strcmp (show, TB_YES));
+ const gchar *show = mixgtk_config_get (SHOW_TB_KEY_);
+ return (!show || !strcmp (show, TB_YES_));
}
void
mixgtk_config_set_show_toolbars (gboolean show)
{
- mixgtk_config_update (SHOW_TB_KEY, show? TB_YES : TB_NO);
+ mixgtk_config_update (SHOW_TB_KEY_, show? TB_YES_ : TB_NO_);
}
diff --git a/mixgtk/mixgtk_config.h b/mixgtk/mixgtk_config.h
index 971c862..9f464c4 100644
--- a/mixgtk/mixgtk_config.h
+++ b/mixgtk/mixgtk_config.h
@@ -41,6 +41,13 @@ mixgtk_config_is_autosave (void);
extern void
mixgtk_config_set_autosave (gboolean autosave);
+/* toolbar style */
+extern guint
+mixgtk_config_tb_style (void);
+
+extern void
+mixgtk_config_set_tb_style (guint style);
+
/* update config item */
extern void
mixgtk_config_update (const gchar *key, const gchar *value);
diff --git a/mixgtk/mixgtk_wm.c b/mixgtk/mixgtk_wm.c
index 6bf691e..c4f2ef6 100644
--- a/mixgtk/mixgtk_wm.c
+++ b/mixgtk/mixgtk_wm.c
@@ -81,6 +81,7 @@ static void mixal_detach_ (void);
static void dev_attach_ (void);
static void dev_detach_ (void);
static void update_attach_buttons_ (void);
+static void on_tb_style_ (GtkMenuItem *w, gpointer style);
static void on_nb_switch_ (GtkNotebook *notebook, GtkWidget *page,
guint page_num, gpointer user_data);
@@ -223,7 +224,6 @@ on_widget_attach (GtkWidget *ign, gpointer id)
mixgtk_wm_attach_window (GPOINTER_TO_INT (id));
}
-
/* about box */
void
on_about_activate (GtkWidget *w, gpointer data)
@@ -438,6 +438,10 @@ init_dev_ (void)
static void
init_tb_ (void)
{
+ gchar *names[4];
+ gint k;
+ gint tb_style = mixgtk_config_tb_style ();
+
tb_menu_ = GTK_CHECK_MENU_ITEM
(mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN,
TB_MENU_NAME_));
@@ -456,6 +460,47 @@ init_tb_ (void)
g_assert (attach_button_);
g_assert (detach_button_);
+
+ names[GTK_TOOLBAR_ICONS] = "tb_style_icons";
+ names[GTK_TOOLBAR_TEXT] = "tb_style_labels";
+ names[GTK_TOOLBAR_BOTH] = "tb_style_both";
+ names[GTK_TOOLBAR_BOTH_HORIZ] = "tb_style_bothh";
+
+ for (k = 0; k < 4; ++k)
+ {
+ GtkWidget *item =
+ mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN, names[k]);
+ g_signal_connect (G_OBJECT (item),
+ "activate",
+ G_CALLBACK (on_tb_style_), GUINT_TO_POINTER (k));
+ if (k == tb_style)
+ {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
+ }
+ }
+}
+
+static void
+on_tb_style_ (GtkMenuItem *w, gpointer style)
+{
+ static const gchar *TB_NAME = "main_toolbar";
+ static const gchar *TB_DNAME = "dlg_toolbar";
+
+ guint ui_style = GPOINTER_TO_UINT (style);
+ gint k;
+
+ GtkToolbar *tb = GTK_TOOLBAR
+ (mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN, TB_NAME));
+ gtk_toolbar_set_style (tb, ui_style);
+
+ for (k = 0; k < INF_NO_; ++k)
+ {
+ GtkToolbar *tb = GTK_TOOLBAR
+ (mixgtk_widget_factory_get_child_by_name (infos_[k].dialog, TB_DNAME));
+ gtk_toolbar_set_style (tb, ui_style);
+ }
+
+ mixgtk_config_set_tb_style (ui_style);
}
static void
@@ -463,7 +508,7 @@ show_toolbars_ (gboolean show)
{
static const gchar *HANDLE_NAME = "tb_handle";
- int k;
+ gint k;
GtkWidget *handle =
mixgtk_widget_factory_get_child_by_name (MIXGTK_MAIN, HANDLE_NAME);