glade3 r1777 - in trunk: . doc gladeui src
- From: tvb svn gnome org
- To: svn-commits-list gnome org
- Subject: glade3 r1777 - in trunk: . doc gladeui src
- Date: Tue, 8 Apr 2008 04:34:49 +0100 (BST)
Author: tvb
Date: Tue Apr 8 04:34:49 2008
New Revision: 1777
URL: http://svn.gnome.org/viewvc/glade3?rev=1777&view=rev
Log:
* src/glade-window.c: Reverted the project format menu from edit
* src/glade-utils.c: Add file format option to "save as" dialog,
also added new filters for .ui files.
Modified:
trunk/ChangeLog
trunk/doc/gladeui-docs.sgml
trunk/gladeui/glade-utils.c
trunk/gladeui/glade-utils.h
trunk/gladeui/glade-widget-adaptor.c
trunk/src/glade-window.c
Modified: trunk/doc/gladeui-docs.sgml
==============================================================================
--- trunk/doc/gladeui-docs.sgml (original)
+++ trunk/doc/gladeui-docs.sgml Tue Apr 8 04:34:49 2008
@@ -35,8 +35,8 @@
<para>
This document attempts to describe how to use the Glade UI Designer core
library to integrate Glade into your application and how to integrate your
-custom GTK+ derived widgets into the Glade UI Builder.
- </para>
+custom GTK+ derived widgets into the Glade UI Designer.
+ </para>
<para>You can always get the latest version of this document <ulink url="http://glade.gnome.org/docs/index.html">here</ulink>
and you should have received a copy with the glade-3 tarball.</para>
Modified: trunk/gladeui/glade-utils.c
==============================================================================
--- trunk/gladeui/glade-utils.c (original)
+++ trunk/gladeui/glade-utils.c Tue Apr 8 04:34:49 2008
@@ -484,18 +484,85 @@
gtk_window_move(window, x, y);
}
+
+static void
+format_libglade_button_clicked (GtkWidget *widget,
+ GladeProject *project)
+{
+ glade_project_set_format (project, GLADE_PROJECT_FORMAT_LIBGLADE);
+}
+
+static void
+format_builder_button_clicked (GtkWidget *widget,
+ GladeProject *project)
+{
+ glade_project_set_format (project, GLADE_PROJECT_FORMAT_GTKBUILDER);
+}
+
+static void
+add_format_options (GtkDialog *dialog,
+ GladeProject *project)
+{
+ GtkWidget *vbox, *frame;
+ GtkWidget *glade_radio, *builder_radio;
+ GtkWidget *label, *alignment;
+ gchar *string = g_strdup_printf ("<b>%s</b>", _("Select file format"));
+
+ frame = gtk_frame_new (NULL);
+ vbox = gtk_vbox_new (FALSE, 0);
+ alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
+
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 2, 0, 12, 0);
+
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
+
+ label = gtk_label_new (string);
+ g_free (string);
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+
+ glade_radio = gtk_radio_button_new_with_label (NULL, "Libglade");
+ builder_radio = gtk_radio_button_new_with_label_from_widget
+ (GTK_RADIO_BUTTON (glade_radio), "GtkBuilder");
+
+ if (glade_project_get_format (project) == GLADE_PROJECT_FORMAT_GTKBUILDER)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (builder_radio), TRUE);
+ else
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (glade_radio), TRUE);
+
+ g_signal_connect (G_OBJECT (glade_radio), "clicked",
+ G_CALLBACK (format_libglade_button_clicked), project);
+
+ g_signal_connect (G_OBJECT (builder_radio), "clicked",
+ G_CALLBACK (format_builder_button_clicked), project);
+
+ gtk_box_pack_start (GTK_BOX (vbox), builder_radio, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), glade_radio, TRUE, TRUE, 2);
+
+ gtk_frame_set_label_widget (GTK_FRAME (frame), label);
+ gtk_container_add (GTK_CONTAINER (alignment), vbox);
+ gtk_container_add (GTK_CONTAINER (frame), alignment);
+
+ gtk_widget_show_all (frame);
+
+ gtk_box_pack_end (GTK_BOX (dialog->vbox), frame, FALSE, TRUE, 2);
+}
+
+
/**
* glade_util_file_dialog_new:
* @title: dialog title
- * @parent: the parent #GtkWindow for the dialog
+ * @project: a #GladeProject used when saving
+ * @parent: a parent #GtkWindow for the dialog
* @action: a #GladeUtilFileDialogType to say if the dialog will open or save
*
* Returns: a "glade file" file chooser dialog. The caller is responsible
* for showing the dialog
*/
GtkWidget *
-glade_util_file_dialog_new (const gchar *title, GtkWindow *parent,
- GladeUtilFileDialogType action)
+glade_util_file_dialog_new (const gchar *title,
+ GladeProject *project,
+ GtkWindow *parent,
+ GladeUtilFileDialogType action)
{
GtkWidget *file_dialog;
GtkFileFilter *file_filter;
@@ -503,6 +570,9 @@
g_return_val_if_fail ((action == GLADE_FILE_DIALOG_ACTION_OPEN ||
action == GLADE_FILE_DIALOG_ACTION_SAVE), NULL);
+ g_return_val_if_fail ((action != GLADE_FILE_DIALOG_ACTION_SAVE ||
+ GLADE_IS_PROJECT (project)), NULL);
+
file_dialog = gtk_file_chooser_dialog_new (title, parent, action,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
@@ -510,6 +580,10 @@
GTK_STOCK_OPEN : GTK_STOCK_SAVE,
GTK_RESPONSE_OK,
NULL);
+
+
+ if (action == GLADE_FILE_DIALOG_ACTION_SAVE)
+ add_format_options (GTK_DIALOG (file_dialog), project);
file_filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (file_filter, "*");
@@ -518,7 +592,18 @@
file_filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (file_filter, "*.glade");
- gtk_file_filter_set_name (file_filter, _("Glade Files"));
+ gtk_file_filter_set_name (file_filter, _("Libglade Files"));
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
+
+ file_filter = gtk_file_filter_new ();
+ gtk_file_filter_add_pattern (file_filter, "*.ui");
+ gtk_file_filter_set_name (file_filter, _("GtkBuilder Files"));
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
+
+ file_filter = gtk_file_filter_new ();
+ gtk_file_filter_add_pattern (file_filter, "*.ui");
+ gtk_file_filter_add_pattern (file_filter, "*.glade");
+ gtk_file_filter_set_name (file_filter, _("All Glade Files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (file_dialog), file_filter);
Modified: trunk/gladeui/glade-utils.h
==============================================================================
--- trunk/gladeui/glade-utils.h (original)
+++ trunk/gladeui/glade-utils.h Tue Apr 8 04:34:49 2008
@@ -51,6 +51,7 @@
GtkWidget *glade_util_file_dialog_new (const gchar *title,
+ GladeProject *project,
GtkWindow *parent,
GladeUtilFileDialogType action);
Modified: trunk/gladeui/glade-widget-adaptor.c
==============================================================================
--- trunk/gladeui/glade-widget-adaptor.c (original)
+++ trunk/gladeui/glade-widget-adaptor.c Tue Apr 8 04:34:49 2008
@@ -26,7 +26,11 @@
* SECTION:glade-widget-adaptor
* @Short_Description: Adaptor base class to add runtime support for each widget class.
*
- * TODO: Add long description.
+ * The #GladeWidgetAdaptor object is a proxy for widget class support in Glade.
+ * it is automatically generated from the xml and allows you to override its
+ * methods in the plugin library for fine grained support on how you load/save
+ * widgets and handle thier properties in the runtime and more.
+ *
*/
#include "glade.h"
Modified: trunk/src/glade-window.c
==============================================================================
--- trunk/src/glade-window.c (original)
+++ trunk/src/glade-window.c Tue Apr 8 04:34:49 2008
@@ -1158,8 +1158,9 @@
GtkWidget *filechooser;
gchar *path = NULL, *default_path;
- filechooser = glade_util_file_dialog_new (_("Open\342\200\246"), GTK_WINDOW (window),
- GLADE_FILE_DIALOG_ACTION_OPEN);
+ filechooser = glade_util_file_dialog_new (_("Open\342\200\246"), NULL,
+ GTK_WINDOW (window),
+ GLADE_FILE_DIALOG_ACTION_OPEN);
default_path = g_strdup (get_default_path (window));
@@ -1279,7 +1280,7 @@
if (project == NULL)
return;
- filechooser = glade_util_file_dialog_new (_("Save As\342\200\246"),
+ filechooser = glade_util_file_dialog_new (_("Save As\342\200\246"), project,
GTK_WINDOW (window),
GLADE_FILE_DIALOG_ACTION_SAVE);
@@ -1454,7 +1455,7 @@
gchar *default_path;
filechooser =
- glade_util_file_dialog_new (_("Save\342\200\246"),
+ glade_util_file_dialog_new (_("Save\342\200\246"), project,
GTK_WINDOW (window),
GLADE_FILE_DIALOG_ACTION_SAVE);
@@ -1691,12 +1692,7 @@
refresh_title (window);
set_sensitivity_according_to_project (window, project);
-
- /* Set project format here */
- action = gtk_action_group_get_action (window->priv->static_actions, "LibgladeFormat");
- gtk_radio_action_set_current_value (GTK_RADIO_ACTION (action),
- glade_project_get_format (project));
-
+
/* switch to the project's inspector */
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->priv->inspectors_notebook), page_num);
@@ -1773,7 +1769,6 @@
{
GladeProject *project;
GladeInspector *inspector;
- GtkAction *action;
--window->priv->num_tabs;
@@ -1803,24 +1798,9 @@
project_selection_changed_cb (glade_app_get_project (), window);
if (window->priv->active_view)
- {
- set_sensitivity_according_to_project
- (window, glade_design_view_get_project (window->priv->active_view));
- action = gtk_action_group_get_action
- (window->priv->static_actions, "LibgladeFormat");
- gtk_radio_action_set_current_value
- (GTK_RADIO_ACTION (action), glade_project_get_format
- (glade_design_view_get_project (window->priv->active_view)));
-
- }
+ set_sensitivity_according_to_project (window, glade_design_view_get_project (window->priv->active_view));
else
- {
- action = gtk_action_group_get_action
- (window->priv->static_actions, "ProjectFormat");
- gtk_action_set_sensitive (action, FALSE);
-
gtk_action_group_set_sensitive (window->priv->project_actions, FALSE);
- }
}
@@ -1848,8 +1828,8 @@
static void
palette_appearance_change_cb (GtkRadioAction *action,
- GtkRadioAction *current,
- GladeWindow *window)
+ GtkRadioAction *current,
+ GladeWindow *window)
{
gint value;
@@ -1859,24 +1839,6 @@
}
-
-static void
-format_change_cb (GtkRadioAction *action,
- GtkRadioAction *current,
- GladeWindow *window)
-{
- gint value;
- GladeProject *project;
-
- value = gtk_radio_action_get_current_value (action);
-
- if (window->priv->active_view)
- {
- project = glade_design_view_get_project (window->priv->active_view);
- glade_project_set_format (project, value);
- }
-}
-
static void
palette_toggle_small_icons_cb (GtkAction *action, GladeWindow *window)
{
@@ -2190,11 +2152,6 @@
" <menuitem action='Copy'/>"
" <menuitem action='Paste'/>"
" <menuitem action='Delete'/>"
-" <separator/>"
-" <menu action='ProjectFormat'>"
-" <menuitem action='LibgladeFormat'/>"
-" <menuitem action='BuilderFormat'/>"
-" </menu>"
" </menu>"
" <menu action='ViewMenu'>"
" <menuitem action='Clipboard'/>"
@@ -2257,9 +2214,6 @@
{ "Quit", GTK_STOCK_QUIT, NULL, "<control>Q",
N_("Quit the program"), G_CALLBACK (quit_cb) },
- /* Edit Menu */
- { "ProjectFormat", NULL, N_("_Project Format") },
-
/* ViewMenu */
{ "PaletteAppearance", NULL, N_("Palette _Appearance") },
@@ -2349,7 +2303,7 @@
};
static guint n_view_entries = G_N_ELEMENTS (view_entries);
-static GtkRadioActionEntry palette_radio_entries[] = {
+static GtkRadioActionEntry radio_entries[] = {
{ "IconsAndLabels", NULL, N_("Text beside icons"), NULL,
N_("Display items as text beside icons"), GLADE_ITEM_ICON_AND_LABEL },
@@ -2359,21 +2313,8 @@
{ "LabelsOnly", NULL, N_("_Text only"), NULL,
N_("Display items as text only"), GLADE_ITEM_LABEL_ONLY },
-
};
-static guint n_palette_radio_entries = G_N_ELEMENTS (palette_radio_entries);
-
-
-static GtkRadioActionEntry format_radio_entries[] = {
-
- { "LibgladeFormat", NULL, N_("Libglade"), NULL,
- N_("Set libglade readable file format"), GLADE_PROJECT_FORMAT_LIBGLADE },
-
- { "BuilderFormat", NULL, N_("Gtk Builder"), NULL,
- N_("Set Gtk Builder file format"), GLADE_PROJECT_FORMAT_GTKBUILDER },
-
-};
-static guint n_format_radio_entries = G_N_ELEMENTS (format_radio_entries);
+static guint n_radio_entries = G_N_ELEMENTS (radio_entries);
static void
menu_item_selected_cb (GtkWidget *item, GladeWindow *window)
@@ -2444,16 +2385,10 @@
view_entries,
n_view_entries,
window);
-
- gtk_action_group_add_radio_actions (window->priv->static_actions, palette_radio_entries,
- n_palette_radio_entries, GLADE_ITEM_ICON_ONLY,
+ gtk_action_group_add_radio_actions (window->priv->static_actions, radio_entries,
+ n_radio_entries, GLADE_ITEM_ICON_ONLY,
G_CALLBACK (palette_appearance_change_cb), window);
- gtk_action_group_add_radio_actions (window->priv->static_actions, format_radio_entries,
- n_format_radio_entries,
- GLADE_PROJECT_FORMAT_GTKBUILDER,
- G_CALLBACK (format_change_cb), window);
-
window->priv->project_actions = gtk_action_group_new (ACTION_GROUP_PROJECT);
gtk_action_group_set_translation_domain (window->priv->project_actions, GETTEXT_PACKAGE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]