From f250835f2e5874f135a6003912fe4839024c768c Mon Sep 17 00:00:00 2001 From: Jonathan Blandford Date: Tue, 29 Jan 2002 03:26:23 +0000 Subject: [PATCH] completely rethink this dialog Mon Jan 28 22:09:30 2002 Jonathan Blandford * gnome-ui-properties.c: completely rethink this dialog --- capplets/ui-properties/ChangeLog | 4 + capplets/ui-properties/Makefile.am | 7 +- capplets/ui-properties/gnome-ui-properties.c | 144 +++++ .../ui-properties/gnome2-ui-properties.glade | 502 ++++++++++++++++++ .../toolbar-menu-properties.glade | 374 +++++++++++++ 5 files changed, 1025 insertions(+), 6 deletions(-) create mode 100644 capplets/ui-properties/gnome-ui-properties.c create mode 100644 capplets/ui-properties/gnome2-ui-properties.glade create mode 100644 capplets/ui-properties/toolbar-menu-properties.glade diff --git a/capplets/ui-properties/ChangeLog b/capplets/ui-properties/ChangeLog index 34f22e423..d960c175b 100644 --- a/capplets/ui-properties/ChangeLog +++ b/capplets/ui-properties/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 28 22:09:30 2002 Jonathan Blandford + + * gnome-ui-properties.c: completely rethink this dialog + 2002-01-27 Seth Nickell * behavior.desktop.in: diff --git a/capplets/ui-properties/Makefile.am b/capplets/ui-properties/Makefile.am index 32581a374..e63b460b5 100644 --- a/capplets/ui-properties/Makefile.am +++ b/capplets/ui-properties/Makefile.am @@ -2,12 +2,7 @@ bin_PROGRAMS = gnome2-ui-properties gnome2_ui_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) gnome2_ui_properties_SOURCES = \ - prefs-widget.c prefs-widget.h\ - prefs-widget-mdi.c prefs-widget-mdi.h\ - prefs-widget-dialogs.c prefs-widget-dialogs.h\ - prefs-widget-app.c prefs-widget-app.h\ - preferences.c preferences.h\ - main.c + gnome-ui-properties.c @INTLTOOL_DESKTOP_RULE@ diff --git a/capplets/ui-properties/gnome-ui-properties.c b/capplets/ui-properties/gnome-ui-properties.c new file mode 100644 index 000000000..ae4c87e6d --- /dev/null +++ b/capplets/ui-properties/gnome-ui-properties.c @@ -0,0 +1,144 @@ +/* gnome-ui-properties.c + * Copyright (C) 2002 Jonathan Blandford + * + * Written by: Jonathan Blandford + * + * 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, 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., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include "capplet-util.h" +#include "gconf-property-editor.h" + + +static GConfEnumStringPair toolbar_style_enums[] = { + { 0, "both" }, + { 1, "icons" }, + { 2, "text" } +}; + +static GConfValue * +toolbar_from_widget (GConfValue *value) +{ + GConfValue *new_value; + + new_value = gconf_value_new (GCONF_VALUE_STRING); + gconf_value_set_string (new_value, + gconf_enum_to_string (toolbar_style_enums, gconf_value_get_int (value))); + + return new_value; +} + +static GConfValue * +toolbar_to_widget (GConfValue *value) +{ + GConfValue *new_value; + gint val = 2; + + new_value = gconf_value_new (GCONF_VALUE_INT); + gconf_string_to_enum (toolbar_style_enums, + gconf_value_get_string (value), + &val); + gconf_value_set_int (new_value, val); + + return new_value; +} + + +static void +dialog_button_clicked_cb (GnomeDialog *dialog, gint response_id, GConfChangeSet *changeset) +{ + switch (response_id) + { + case GTK_RESPONSE_APPLY: + gconf_client_commit_change_set (gconf_client_get_default (), changeset, TRUE, NULL); + break; + case GTK_RESPONSE_HELP: + break; + case GTK_RESPONSE_CLOSE: + case GTK_RESPONSE_DELETE_EVENT: + default: + gtk_main_quit (); + break; + } +} + +static GladeXML * +create_dialog (void) +{ + GladeXML *dialog; + + // dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-keyboard-properties.glade", "keyboard_dialog", NULL); + dialog = glade_xml_new ("gnome2-ui-properties.glade", "gnome_ui_properties_dialog", NULL); + return dialog; +} + +static void +setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) +{ + GtkWidget *widget; + + gconf_peditor_new_boolean + (changeset, "/desktop/gnome/interface/toolbar_detachable", WID ("detachable_toolbars_toggle"), NULL); + + gconf_peditor_new_boolean + (changeset, "/desktop/gnome/interface/menus_have_icons", WID ("menu_icons_toggle"), NULL); + + gconf_peditor_new_select_menu + (changeset, "/desktop/gnome/interface/toolbar_style", WID ("toolbar_style_omenu"), + "conv-to-widget-cb", toolbar_to_widget, + "conv-from-widget-cb", toolbar_from_widget, + NULL); + + + widget = WID ("gnome_ui_properties_dialog"); + g_signal_connect (G_OBJECT (widget), "response", + (GCallback) dialog_button_clicked_cb, changeset); + gtk_widget_show_all (widget); + +} + +int +main (int argc, char **argv) +{ + GConfClient *client; + GladeXML *dialog; + + bindtextdomain (PACKAGE, GNOMELOCALEDIR); + bind_textdomain_codeset (PACKAGE, "UTF-8"); + textdomain (PACKAGE); + + gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv, + GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, + NULL); + + client = gconf_client_get_default (); + gconf_client_add_dir (client, "/desktop/gnome/interface", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + + dialog = create_dialog (); + setup_dialog (dialog, NULL); + + gtk_main (); + + return 0; +} diff --git a/capplets/ui-properties/gnome2-ui-properties.glade b/capplets/ui-properties/gnome2-ui-properties.glade new file mode 100644 index 000000000..362e4c349 --- /dev/null +++ b/capplets/ui-properties/gnome2-ui-properties.glade @@ -0,0 +1,502 @@ + + + + + + Toolbar and Menu Properties + GTK_WINDOW_TOPLEVEL + no + no + yes + no + GTK_WIN_POS_NONE + + + + no + 8 + yes + + + + GTK_BUTTONBOX_END + 8 + yes + + + + yes + yes + yes + gtk-help + yes + + yes + + + + + + yes + yes + + yes + gtk-close + yes + yes + + + + + 0 + no + yes + GTK_PACK_END + + + + + + 4 + no + 8 + yes + + + + Toolbar + 0 + GTK_SHADOW_ETCHED_IN + yes + + + + 4 + no + 4 + yes + + + + no + 0 + yes + + + + _Toolbars have: + GTK_JUSTIFY_CENTER + no + 0.5 + 0.5 + 0 + 0 + toolbar_style_omenu + yes + yes + + + 0 + no + no + + + + + + yes + 2 + yes + + + + yes + + + + yes + + + + Icons and Text + 0.0 + convertwidget2 + yes + yes + + + + + + + + yes + + + + Only Icons + 0.0 + convertwidget3 + yes + yes + + + + + + + + yes + + + + Only Text + 0.0 + convertwidget4 + yes + yes + + + + + + + + + 0 + no + no + + + + + 0 + no + yes + + + + + + yes + Toolbars can be _detached and moved around + yes + yes + yes + yes + + + 0 + no + no + + + + + + Sample Toolbar + 0 + GTK_SHADOW_NONE + yes + + + + GTK_POS_LEFT + GTK_POS_TOP + GTK_SHADOW_OUT + yes + + + + 1 + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + yes + + + + New File + Item 1 + gtk-new + yes + + + + + + Open File + Item 2 + gtk-open + yes + + + + + + Save File + Item 3 + gtk-save + yes + + + + + + + + + 0 + no + no + + + + + + + 0 + yes + yes + + + + + + Menus + 0 + GTK_SHADOW_ETCHED_IN + yes + + + + 4 + no + 4 + yes + + + + yes + Menu items have _icons + yes + yes + yes + yes + + + 0 + no + no + + + + + + Sample Menubar + 0 + GTK_SHADOW_NONE + yes + + + + yes + + + + yes + + + + yes + + + + yes + + + + + + gtk-new + yes + + + + + + Menu Item 1 + 0.0 + menu_item_1 + yes + yes + + + + + + + + yes + + + + + + gtk-open + yes + + + + + + Menu Item 2 + 0.0 + menu_item_2 + yes + yes + + + + + + + + yes + + + + + + gtk-save + yes + + + + + + Menu Item 3 + 0.0 + menu_item_3 + yes + yes + + + + + + + + yes + + + + + + yes + + + + + + gtk-print + yes + + + + + + Menu Item 4 + 0.0 + menu_item_4 + yes + yes + + + + + + + + yes + + + + + + yes + + + + + + gtk-quit + yes + + + + + + Menu Item 5 + 0.0 + menu_item_5 + yes + yes + + + + + + + + + + gnome-stock-about + yes + + + + + + _Menu + 0.0 + menu1 + yes + yes + + + + + + + + + 0 + no + yes + + + + + + + 0 + yes + yes + + + + + 0 + yes + yes + + + + + 4 + yes + yes + + + + diff --git a/capplets/ui-properties/toolbar-menu-properties.glade b/capplets/ui-properties/toolbar-menu-properties.glade new file mode 100644 index 000000000..a7f215b11 --- /dev/null +++ b/capplets/ui-properties/toolbar-menu-properties.glade @@ -0,0 +1,374 @@ + + + + + Ui + ui + + src + pixmaps + C + True + True + + + + GnomeDialog + gnome_ui_properties_dialog + Toolbar and Menu Properties + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + True + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox2 + False + 8 + + 4 + True + True + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area2 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button10 + True + True + GNOME_STOCK_BUTTON_HELP + + + + GtkButton + button12 + True + True + GNOME_STOCK_BUTTON_CLOSE + + + + + GtkVBox + vbox2 + 4 + False + 8 + + 0 + True + True + + + + GtkFrame + frame4 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkVBox + vbox3 + 4 + False + 4 + + + GtkHBox + hbox1 + False + 0 + + 0 + False + True + + + + GtkLabel + label5 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + toolbar_style_omenu + + 0 + False + False + + + + + GtkOptionMenu + toolbar_style_omenu + True + Icons and Text +Only Icons +Only Text + + 2 + + 0 + False + False + + + + + + GtkCheckButton + detachable_toolbars_toggle + True + + True + True + + 0 + False + False + + + + + GtkFrame + frame2 + + 0 + GTK_SHADOW_NONE + + 0 + False + False + + + + GtkHandleBox + toolbar_handlebox + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + + GtkToolbar + toolbar_toolbar + 1 + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + 16 + GTK_TOOLBAR_SPACE_LINE + GTK_RELIEF_NONE + True + + + GtkButton + Toolbar:button + button7 + New File + + GNOME_STOCK_PIXMAP_NEW + + + + GtkButton + Toolbar:button + button8 + Open File + + GNOME_STOCK_PIXMAP_OPEN + + + + GtkButton + Toolbar:button + button9 + Save File + + GNOME_STOCK_PIXMAP_SAVE + + + + + + + + + GtkFrame + frame5 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkVBox + vbox4 + 4 + False + 4 + + + GtkCheckButton + menu_icons_toggle + True + + True + True + + 0 + False + False + + + + + GtkFrame + frame3 + + 0 + GTK_SHADOW_NONE + + 0 + False + True + + + + GtkMenuBar + menubar1 + GTK_SHADOW_OUT + + + GtkPixmapMenuItem + menu1 + + False + GNOME_STOCK_MENU_ABOUT + + + GtkMenu + menu1_menu + + + GtkPixmapMenuItem + menu_item_1 + + activate + on_menu_item_1_activate + Thu, 24 Jan 2002 03:40:54 GMT + + + False + GNOME_STOCK_MENU_NEW + + + + GtkPixmapMenuItem + menu_item_2 + + activate + on_menu_item_2_activate + Thu, 24 Jan 2002 03:40:54 GMT + + + False + GNOME_STOCK_MENU_OPEN + + + + GtkPixmapMenuItem + menu_item_3 + + activate + on_menu_item_3_activate + Thu, 24 Jan 2002 03:40:54 GMT + + + False + GNOME_STOCK_MENU_SAVE + + + + GtkMenuItem + separator3 + False + + + + GtkPixmapMenuItem + menu_item_4 + + activate + on_menu_item_5_activate + Thu, 24 Jan 2002 03:44:44 GMT + + + False + GNOME_STOCK_MENU_PRINT + + + + GtkMenuItem + separator4 + False + + + + GtkPixmapMenuItem + menu_item_5 + + activate + on_menu_item_6_activate + Thu, 24 Jan 2002 03:40:54 GMT + + + False + GNOME_STOCK_MENU_EXIT + + + + + + + + + + + +