Commit cd195dc91c312d686b1d29efb2c95108e9545401
- Diff rendering mode:
- inline
- side by side
gladeui/Makefile.am
(2 / 0)
|   | |||
| 44 | 44 | glade-utils.c \ | |
| 45 | 45 | glade-signal.c \ | |
| 46 | 46 | glade-signal-editor.c \ | |
| 47 | glade-settings-editor.c \ | ||
| 47 | 48 | glade-clipboard.c \ | |
| 48 | 49 | glade-clipboard-view.c \ | |
| 49 | 50 | glade-command.c \ | |
| … | … | ||
| 97 | 97 | glade-editor.h \ | |
| 98 | 98 | glade-editor-property.h \ | |
| 99 | 99 | glade-signal-editor.h \ | |
| 100 | glade-settings-editor.h \ | ||
| 100 | 101 | glade-palette.h \ | |
| 101 | 102 | glade-palette-item.h \ | |
| 102 | 103 | glade-design-layout.h \ |
gladeui/glade-app.c
(39 / 10)
|   | |||
| 75 | 75 | { | |
| 76 | 76 | GtkWidget *window; | |
| 77 | 77 | ||
| 78 | GladePalette *palette; /* See glade-palette */ | ||
| 79 | GladeProject *active_project; /* Currently active project (if there is at least one | ||
| 80 | * project; then this is always valid) */ | ||
| 81 | GladeEditor *editor; /* See glade-editor */ | ||
| 82 | GladeClipboard *clipboard; /* See glade-clipboard */ | ||
| 83 | GList *catalogs; /* See glade-catalog */ | ||
| 78 | GladePalette *palette; /* See glade-palette */ | ||
| 79 | GladeProject *active_project; /* Currently active project (if there is at least one | ||
| 80 | * project; then this is always valid) */ | ||
| 81 | GladeEditor *editor; /* See glade-editor */ | ||
| 82 | GladeSettingsEditor *settings_editor; /* See glade-settings-editor */ | ||
| 83 | GladeClipboard *clipboard; /* See glade-clipboard */ | ||
| 84 | GList *catalogs; /* See glade-catalog */ | ||
| 84 | 85 | ||
| 85 | 86 | GList *projects; /* The list of Projects */ | |
| 86 | 87 | ||
| … | … | ||
| 172 | 172 | g_object_unref (priv->editor); | |
| 173 | 173 | priv->editor = NULL; | |
| 174 | 174 | } | |
| 175 | if (priv->settings_editor) | ||
| 176 | { | ||
| 177 | g_object_unref (priv->settings_editor); | ||
| 178 | priv->settings_editor = NULL; | ||
| 179 | }; | ||
| 175 | 180 | if (priv->palette) | |
| 176 | 181 | { | |
| 177 | 182 | g_object_unref (priv->palette); | |
| … | … | ||
| 305 | 305 | glade_signal_editor_construct_signals_list (signal_editor); | |
| 306 | 306 | } | |
| 307 | 307 | ||
| 308 | static void | ||
| 309 | glade_app_show_settings_default (GladeApp *app, GladeWidget *widget, GladeProperty *property) | ||
| 310 | { | ||
| 311 | glade_settings_editor_show (app->priv->settings_editor, widget, property); | ||
| 312 | } | ||
| 313 | |||
| 308 | 314 | static gboolean | |
| 309 | 315 | clipboard_view_on_delete_cb (GtkWidget *clipboard_view, GdkEvent *e, GladeApp *app) | |
| 310 | 316 | { | |
| … | … | ||
| 458 | 458 | /* Create Editor */ | |
| 459 | 459 | app->priv->editor = GLADE_EDITOR (glade_editor_new ()); | |
| 460 | 460 | g_object_ref_sink (GTK_OBJECT (app->priv->editor)); | |
| 461 | |||
| 461 | |||
| 462 | 462 | glade_editor_refresh (app->priv->editor); | |
| 463 | |||
| 463 | |||
| 464 | /* Create Settings Connection Editor */ | ||
| 465 | app->priv->settings_editor = GLADE_SETTINGS_EDITOR (glade_settings_editor_new ()); | ||
| 466 | g_object_ref_sink (GTK_OBJECT (app->priv->settings_editor)); | ||
| 467 | |||
| 464 | 468 | /* Create clipboard */ | |
| 465 | 469 | app->priv->clipboard = glade_clipboard_new (); | |
| 466 | 470 | app->priv->clipboard->view = glade_clipboard_view_new (app->priv->clipboard); | |
| … | … | ||
| 497 | 497 | klass->signal_editor_created = glade_app_signal_editor_created_default; | |
| 498 | 498 | klass->show_properties = NULL; | |
| 499 | 499 | klass->hide_properties = NULL; | |
| 500 | klass->show_settings = glade_app_show_settings_default; | ||
| 500 | 501 | ||
| 501 | 502 | /** | |
| 502 | 503 | * GladeApp::update-ui: | |
| … | … | ||
| 515 | 515 | g_cclosure_marshal_VOID__VOID, | |
| 516 | 516 | G_TYPE_NONE, 0); | |
| 517 | 517 | ||
| 518 | /** | ||
| 518 | /**editor | ||
| 519 | 519 | * GladeApp::signal-editor-created: | |
| 520 | 520 | * @gladeapp: the #GladeApp which received the signal. | |
| 521 | 521 | * @signal_editor: the new #GladeSignalEditor. | |
| … | … | ||
| 942 | 942 | GLADE_APP_GET_CLASS (app)->hide_properties (app); | |
| 943 | 943 | else | |
| 944 | 944 | g_critical ("%s not implemented\n", G_STRFUNC); | |
| 945 | |||
| 946 | 945 | } | |
| 946 | |||
| 947 | /* Show dialog for binding settings to 'widget'. If 'property' is non-NULL this | ||
| 948 | * is intially entered or selected in the editor. */ | ||
| 949 | void | ||
| 950 | glade_app_show_settings (GladeWidget *widget, GladeProperty *property) | ||
| 951 | { | ||
| 952 | GladeApp *app = glade_app_get (); | ||
| 953 | |||
| 954 | if (GLADE_APP_GET_CLASS (app)->show_settings) | ||
| 955 | GLADE_APP_GET_CLASS (app)->show_settings (app, widget, property); | ||
| 956 | else | ||
| 957 | g_critical ("%s not implemented\n", G_STRFUNC); | ||
| 958 | }; | ||
| 947 | 959 | ||
| 948 | 960 | void | |
| 949 | 961 | glade_app_update_instance_count (GladeProject *project) |
gladeui/glade-app.h
(3 / 0)
|   | |||
| 79 | 79 | void (* show_properties) (GladeApp* app, | |
| 80 | 80 | gboolean raise); | |
| 81 | 81 | void (* hide_properties) (GladeApp* app); | |
| 82 | void (* show_settings) (GladeApp *app, GladeWidget *widget, GladeProperty *property); | ||
| 82 | 83 | ||
| 83 | 84 | /* signals */ | |
| 84 | 85 | void (* update_ui_signal) (GladeApp *app); | |
| … | … | ||
| 141 | 141 | ||
| 142 | 142 | void glade_app_hide_properties (void); | |
| 143 | 143 | ||
| 144 | void glade_app_show_settings (GladeWidget *widget, GladeProperty *property); | ||
| 144 | 145 | ||
| 146 | |||
| 145 | 147 | void glade_app_command_copy (void); | |
| 146 | 148 | ||
| 147 | 149 | void glade_app_command_cut (void); |
gladeui/glade-popup.c
(10 / 0)
|   | |||
| 696 | 696 | } | |
| 697 | 697 | ||
| 698 | 698 | static void | |
| 699 | glade_popup_connect_property_to_setting_cb (GtkMenuItem *item, | ||
| 700 | GladeProperty *property) | ||
| 701 | { | ||
| 702 | glade_app_show_settings (property->widget, property); | ||
| 703 | } | ||
| 704 | |||
| 705 | static void | ||
| 699 | 706 | glade_popup_clear_property_cb (GtkMenuItem *item, | |
| 700 | 707 | GladeProperty *property) | |
| 701 | 708 | { | |
| … | … | ||
| 750 | 750 | g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor)); | |
| 751 | 751 | ||
| 752 | 752 | popup_menu = gtk_menu_new (); | |
| 753 | |||
| 754 | glade_popup_append_item (popup_menu, NULL, _("Connect to setting..."), NULL, | ||
| 755 | TRUE, glade_popup_connect_property_to_setting_cb, property); | ||
| 753 | 756 | ||
| 754 | 757 | glade_popup_append_item (popup_menu, GTK_STOCK_CLEAR, _("Set default value"), NULL, | |
| 755 | 758 | TRUE, glade_popup_clear_property_cb, property); |
gladeui/glade-settings-editor.c
(190 / 0)
|   | |||
| 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2001 Ximian, Inc. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as | ||
| 7 | * published by the Free Software Foundation; either version 2 of the | ||
| 8 | * License, or (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 18 | * | ||
| 19 | * Authors: | ||
| 20 | * Sam Thursfield <ssssam@gmail.com> | ||
| 21 | */ | ||
| 22 | #ifdef HAVE_CONFIG_H | ||
| 23 | #include <config.h> | ||
| 24 | #endif | ||
| 25 | |||
| 26 | /** | ||
| 27 | * SECTION:glade-settings-editor | ||
| 28 | * @Title: GladeSettingsEditor | ||
| 29 | * @Short_Description: An interface to edit settings for a #GladeWidget. | ||
| 30 | */ | ||
| 31 | |||
| 32 | #include <string.h> | ||
| 33 | #include <glib/gi18n-lib.h> | ||
| 34 | |||
| 35 | #include "glade.h" | ||
| 36 | /*#include "glade-widget.h" | ||
| 37 | #include "glade-widget-adaptor.h" | ||
| 38 | #include "glade-signal.h" | ||
| 39 | #include "glade-signal-editor.h" | ||
| 40 | #include "glade-editor.h" | ||
| 41 | #include "glade-command.h" | ||
| 42 | #include "glade-marshallers.h" | ||
| 43 | #include "glade-accumulators.h"*/ | ||
| 44 | |||
| 45 | |||
| 46 | G_DEFINE_TYPE (GladeSettingsEditor, glade_settings_editor, GTK_TYPE_OBJECT) | ||
| 47 | |||
| 48 | #define KEY_DEFAULT _("<Type here>") | ||
| 49 | |||
| 50 | void | ||
| 51 | glade_settings_editor_show (GladeSettingsEditor *self, | ||
| 52 | GladeWidget *widget, | ||
| 53 | GladeProperty *property) | ||
| 54 | { | ||
| 55 | glade_settings_editor_set_widget (self, widget); | ||
| 56 | glade_settings_editor_set_property (self, property); | ||
| 57 | |||
| 58 | gtk_widget_show_all (self->dialog); | ||
| 59 | }; | ||
| 60 | |||
| 61 | void | ||
| 62 | glade_settings_editor_set_widget (GladeSettingsEditor *self, | ||
| 63 | GladeWidget *widget) | ||
| 64 | { | ||
| 65 | if (widget == self->widget) | ||
| 66 | return; | ||
| 67 | |||
| 68 | // FIXME: load all bound properties into treeview | ||
| 69 | // should a widget keep a list of all its bound properties to save us going through | ||
| 70 | // each one? | ||
| 71 | |||
| 72 | self->widget = widget; | ||
| 73 | }; | ||
| 74 | |||
| 75 | void | ||
| 76 | glade_settings_editor_set_property (GladeSettingsEditor *self, | ||
| 77 | GladeProperty *property) | ||
| 78 | { | ||
| 79 | GladePropertyClass *property_class; | ||
| 80 | GtkTreeIter iter; | ||
| 81 | |||
| 82 | property_class = property->klass; | ||
| 83 | |||
| 84 | if (property->widget != self->widget) | ||
| 85 | glade_settings_editor_set_widget (self, property->widget); | ||
| 86 | |||
| 87 | // FIXME: look for property in list | ||
| 88 | gtk_list_store_append (GTK_LIST_STORE (self->data), &iter); | ||
| 89 | // FIXME: set tooltip as klass->name | ||
| 90 | gtk_list_store_set (GTK_LIST_STORE (self->data), &iter, | ||
| 91 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, property_class->id, | ||
| 92 | GLADE_SETTINGS_EDITOR_COLUMN_KEY, KEY_DEFAULT, | ||
| 93 | -1); | ||
| 94 | }; | ||
| 95 | |||
| 96 | static void | ||
| 97 | dialog_response (GtkDialog *dialog) | ||
| 98 | { | ||
| 99 | gtk_widget_hide (GTK_WIDGET (dialog)); | ||
| 100 | }; | ||
| 101 | |||
| 102 | static GObject* | ||
| 103 | glade_settings_editor_constructor (GType type, | ||
| 104 | guint n_construct_properties, | ||
| 105 | GObjectConstructParam *construct_properties) | ||
| 106 | { | ||
| 107 | GladeSettingsEditor *self; | ||
| 108 | GObject *retval; | ||
| 109 | GtkWidget *tree_view; | ||
| 110 | GtkCellRenderer *cell_renderer; | ||
| 111 | GtkTreeViewColumn *column; | ||
| 112 | |||
| 113 | retval = G_OBJECT_CLASS (glade_settings_editor_parent_class)->constructor | ||
| 114 | (type, n_construct_properties, construct_properties); | ||
| 115 | self = GLADE_SETTINGS_EDITOR (retval); | ||
| 116 | |||
| 117 | self->data = GTK_TREE_MODEL (gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING)); | ||
| 118 | |||
| 119 | self->dialog = gtk_dialog_new_with_buttons (_("Settings connections"), | ||
| 120 | GTK_WINDOW (glade_app_get_window ()), 0, | ||
| 121 | GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | ||
| 122 | NULL); | ||
| 123 | |||
| 124 | tree_view = gtk_tree_view_new_with_model (self->data); | ||
| 125 | gtk_widget_set_size_request (tree_view, 200, 200); | ||
| 126 | |||
| 127 | cell_renderer = gtk_cell_renderer_text_new (); | ||
| 128 | column = gtk_tree_view_column_new_with_attributes | ||
| 129 | (_("Property Name"), cell_renderer, | ||
| 130 | "text", GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, | ||
| 131 | NULL); | ||
| 132 | gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); | ||
| 133 | |||
| 134 | cell_renderer = gtk_cell_renderer_text_new (); | ||
| 135 | g_object_set (cell_renderer, "editable", TRUE, NULL); | ||
| 136 | column = gtk_tree_view_column_new_with_attributes | ||
| 137 | (_("Settings Key"), cell_renderer, | ||
| 138 | "text", GLADE_SETTINGS_EDITOR_COLUMN_KEY, | ||
| 139 | NULL); | ||
| 140 | gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); | ||
| 141 | |||
| 142 | gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (self->dialog))), | ||
| 143 | tree_view); | ||
| 144 | |||
| 145 | g_signal_connect (self->dialog, "response", G_CALLBACK (dialog_response), NULL); | ||
| 146 | |||
| 147 | return retval; | ||
| 148 | }; | ||
| 149 | |||
| 150 | /** | ||
| 151 | * glade_settings_editor_new: | ||
| 152 | * | ||
| 153 | * Returns: a new #GladeSettingsEditor | ||
| 154 | */ | ||
| 155 | GladeSettingsEditor * | ||
| 156 | glade_settings_editor_new () | ||
| 157 | { | ||
| 158 | GladeSettingsEditor *settings_editor; | ||
| 159 | |||
| 160 | settings_editor = GLADE_SETTINGS_EDITOR (g_object_new (GLADE_TYPE_SETTINGS_EDITOR, | ||
| 161 | NULL, NULL)); | ||
| 162 | |||
| 163 | return settings_editor; | ||
| 164 | } | ||
| 165 | |||
| 166 | static void | ||
| 167 | glade_settings_editor_finalize (GObject *object) | ||
| 168 | { | ||
| 169 | //GladeSettingsEditor *self = GLADE_SETTINGS_EDITOR (object); | ||
| 170 | |||
| 171 | G_OBJECT_CLASS (glade_settings_editor_parent_class)->finalize (object); | ||
| 172 | } | ||
| 173 | |||
| 174 | static void | ||
| 175 | glade_settings_editor_init (GladeSettingsEditor *self) | ||
| 176 | { | ||
| 177 | self->widget = NULL; | ||
| 178 | }; | ||
| 179 | |||
| 180 | static void | ||
| 181 | glade_settings_editor_class_init (GladeSettingsEditorClass *klass) | ||
| 182 | { | ||
| 183 | GObjectClass *object_class; | ||
| 184 | |||
| 185 | glade_settings_editor_parent_class = g_type_class_peek_parent (klass); | ||
| 186 | object_class = G_OBJECT_CLASS (klass); | ||
| 187 | |||
| 188 | object_class->constructor = glade_settings_editor_constructor; | ||
| 189 | object_class->finalize = glade_settings_editor_finalize; | ||
| 190 | }; |
gladeui/glade-settings-editor.h
(56 / 0)
|   | |||
| 1 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ | ||
| 2 | #ifndef __GLADE_SETTINGS_EDITOR_H__ | ||
| 3 | #define __GLADE_SETTINGS_EDITOR_H__ | ||
| 4 | |||
| 5 | #include <gladeui/glade.h> | ||
| 6 | |||
| 7 | G_BEGIN_DECLS | ||
| 8 | |||
| 9 | #define GLADE_TYPE_SETTINGS_EDITOR (glade_settings_editor_get_type ()) | ||
| 10 | #define GLADE_SETTINGS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_SETTINGS_EDITOR, GladeSettingsEditor)) | ||
| 11 | #define GLADE_SETTINGS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_SETTINGS_EDITOR, GladeSettingsEditorClass)) | ||
| 12 | #define GLADE_IS_SETTINGS_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_SETTINGS_EDITOR)) | ||
| 13 | #define GLADE_IS_SETTINGS_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_SETTINGS_EDITOR)) | ||
| 14 | #define GLADE_SETTINGS_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_SETTINGS_EDITOR, GladeSettingsEditorClass)) | ||
| 15 | |||
| 16 | typedef struct _GladeSettingsEditor GladeSettingsEditor; | ||
| 17 | typedef struct _GladeSettingsEditorClass GladeSettingsEditorClass; | ||
| 18 | |||
| 19 | enum | ||
| 20 | { | ||
| 21 | GLADE_SETTINGS_EDITOR_COLUMN_PROPERTY, | ||
| 22 | GLADE_SETTINGS_EDITOR_COLUMN_KEY, | ||
| 23 | GLADE_SETTINGS_EDITOR_NUM_COLUMNS | ||
| 24 | }; | ||
| 25 | |||
| 26 | /* The GladeSettingsEditor is used to house the signal editor interface and | ||
| 27 | * associated functionality. | ||
| 28 | */ | ||
| 29 | struct _GladeSettingsEditor | ||
| 30 | { | ||
| 31 | GtkObject parent; | ||
| 32 | |||
| 33 | GladeWidget *widget; /* Widget currently having its properties bound */ | ||
| 34 | |||
| 35 | GtkWidget *dialog; | ||
| 36 | GtkTreeModel *data; | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct _GladeSettingsEditorClass | ||
| 40 | { | ||
| 41 | GtkObjectClass parent_class; | ||
| 42 | }; | ||
| 43 | |||
| 44 | GType glade_settings_editor_get_type (void) G_GNUC_CONST; | ||
| 45 | |||
| 46 | GladeSettingsEditor *glade_settings_editor_new (); | ||
| 47 | |||
| 48 | void glade_settings_editor_show (GladeSettingsEditor *self, GladeWidget *widget, | ||
| 49 | GladeProperty *property); | ||
| 50 | |||
| 51 | void glade_settings_editor_set_widget (GladeSettingsEditor *self, GladeWidget *widget); | ||
| 52 | void glade_settings_editor_set_property (GladeSettingsEditor *self, GladeProperty *property); | ||
| 53 | |||
| 54 | G_END_DECLS | ||
| 55 | |||
| 56 | #endif /* __GLADE_SETTINGS_EDITOR_H__ */ |
gladeui/glade.h
(1 / 0)
|   | |||
| 35 | 35 | #include <gladeui/glade-design-view.h> | |
| 36 | 36 | #include <gladeui/glade-editor.h> | |
| 37 | 37 | #include <gladeui/glade-editor-property.h> | |
| 38 | #include <gladeui/glade-settings-editor.h> | ||
| 38 | 39 | #include <gladeui/glade-palette.h> | |
| 39 | 40 | #include <gladeui/glade-clipboard.h> | |
| 40 | 41 | #include <gladeui/glade-clipboard-view.h> |

