Commit 8a7046af authored by Johannes Schmid's avatar Johannes Schmid
Browse files

Merge branch 'master' into signal-tree-model

parents 148255f0 52330855
2011-01-09 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-design-layout.c: Fixed to not hide widgets when removing
them from the layout (no longer needed trickery for the toplevel, makes parentless
widget property references work properly).
* gladeui/glade-project.c: Fixed the project to maintain the loading flag until
parse-finished is fired (so that it can be checked when setting the final object
properties).
* plugins/gtk+/glade-gtk.c: Fixed loaded state of toolitemgroup custom label widget.
* plugins/gtk+/gtk+.xml.in: Added translatable/multiline to entry tooltip properties
* gladeui/glade-command.[ch]: Exposed glade_command_add() internal command so that
plugins can create command groups that play with adding/removing widgets inline without
creating copies of them.
* plugins/gtk+/glade-gtk.c: Fixed add/remove parent commands so that they work with
parentless widget references (i.e. you can add a parent to a GtkToolItemGroup's label widget
or a GtkButton's image widget, or remove the parent of a child of a label-widget, etc).
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Write GtkToolButton menu children
out as "menu" special child type.
* plugins/gtk+/gtk+.xml.in:
- Made all GdkColor type properties optional, closes bug 457969
- Disabled all the irrelevant "-set" properties of GtkTextTag.
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Added replace-child-function to
gtkmenutoolbutton code (incase the child is rebuilt for construct-only purposes).
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Add support for adding texttags to
texttagtable.
* plugins/gtk+/gtk+.xml.in: Disable the GtkToolButton:menu property.
* gladeui/glade-editor.c: Make query dialog come with a "Create" button instead
of an "OK" button, closes bug 503621.
* plugins/gtk+/gtk+.xml.in: Setting some default HIG values for widgets as per bug 349447.
* src/glade-window.c: Fixed use of uninitialized variables in warning messages,
bug 634325, fix by Alex Merry.
* plugins/gtk+/glade-column-types.c: Fixed crash when user performs Drag'n'Drop of
< enter column here > and no columns are yet added (fixes bug 633943).
2011-01-08 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c,
gladeui/glade-widget-adaptor.c, gladeui/glade-editor-property.c:
Removed glade_util_class_implements_interface() in favor of g_type_is_a() (closes bug 455734).
* gladeui/glade-utils.[ch]: Some cleanup in glade-utils, removed lots of obsolete stuff.
* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-project.c,
gladeui/glade-popup.c, gladeui/glade-placeholder.c: Removed global selection list
from glade-utils, selection can only be placed on widgets and only be controlled
by their owning project.
* gladeui/glade-builtins.c: Fixed redundant registering of displayable values for
stock items.
* plugins/gtk+/gtk+.xml.in: Made plugin target from 2.20, 2.22, 2.24 and 3.0, updated
new properties and signals introduced with 3.0.
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Made GtkToolBar:icon-size an
optional property to discourage its use and gave it similar treatment as the
toolbar-style property.
* gladeui/glade-command.c: Ensure that menus can be added to menutoolbuttons.
* plugins/Makefile.am, plugins/glade-tool-item-group-editor.[ch], plugins/gtk+.xml.in,
plugins/glade-gtk.c: Added support for editing GtkToolPalette.
2011-01-07 Emilio Pozuelo Monfort <pochu27@gmail.com>
* configure.ac: Bump the minimum GTK+ version to 2.99.0.
2011-01-07 Emilio Pozuelo Monfort <pochu27@gmail.com>
* configure.ac: Remove "GTK+ version" from the summary, we always
build against GTK+ 3 now.
2011-01-07 Emilio Pozuelo Monfort <pochu27@gmail.com>
* data/glade.desktop.in.in: Execute 'glade' since that's the name
of the binary now.
2011-01-07 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-inspector.c: Updated to use GtkStyleContext to set the italic &
insensitive color for the < search widgets > entry.
* plugins/gtk+/glade-model-data.c: Removed sequential editing mode, avoid
crashers when focus/start-editing next cell.
* plugins/gtk+/glade-gtk.c: Added accelerator and tooltip-text properties
to menu items and toolitems in the menu editor (fixes bug 510083).
* gladeui/glade-editable.[ch], plugins/gtk+/.. [ All GladeEditable editors ].
GladeEditable now watches the project for changes and updates itself by way
of the base class implementation (and is fixed for removed widgets that no
longer have a project pointer available), also glade_editable_block/unblock()
is added for implementations to avoid firing implicit loads while executing
commands... all custom editors updated to lose much code.
2011-01-06 Tristan Van Berkom <tristanvb@openismus.com>
* gladeui/glade-signal.c: Fixed glade_signal_load() careless mistake after GObjectifying.
......
......@@ -122,7 +122,7 @@ GTK_DOC_CHECK([1.13],[--flavour no-tmpl])
dnl ================================================================
dnl Check for gtk+
dnl ================================================================
GTK_REQUIRED=2.91.2
GTK_REQUIRED=2.99.0
PKG_CHECK_MODULES([GTK],[
gtk+-3.0 >= $GTK_REQUIRED
libxml-2.0 >= 2.4.0
......@@ -287,7 +287,6 @@ Configuration:
Source code location: ${srcdir}
Compiler: ${CC}
GTK+ version: $with_gtk
GTK+ UNIX Print Widgets: ${have_unix_print}
PYTHON Widgets support: ${have_python}
......
......@@ -3,7 +3,7 @@ _Name=Glade
_GenericName=Interface Designer
_X-GNOME-FullName=Glade Interface Designer
_Comment=Create or open user interface designs for GTK+ applications
Exec=glade-3 %F
Exec=glade %F
Terminal=false
StartupNotify=true
Type=Application
......
......@@ -276,8 +276,9 @@ glade_standard_stock_get_type (void)
if (gtk_stock_lookup (enum_values[i].value_nick, &item))
{
gchar *clean_name = clean_stock_name (item.label);
glade_register_translated_value (etype, enum_values[i].value_nick,
clean_name);
if (!glade_get_displayable_value (etype, enum_values[i].value_nick))
glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
g_free (clean_name);
}
}
......@@ -310,8 +311,8 @@ glade_standard_stock_image_get_type (void)
gchar *clean_name = clean_stock_name (item.label);
/* These are translated, we just cut out the mnemonic underscores */
glade_register_translated_value (etype, enum_values[i].value_nick,
clean_name);
if (!glade_get_displayable_value (etype, enum_values[i].value_nick))
glade_register_translated_value (etype, enum_values[i].value_nick, clean_name);
g_free (clean_name);
}
}
......@@ -319,10 +320,11 @@ glade_standard_stock_image_get_type (void)
for (i = 0; i < G_N_ELEMENTS (builtin_stock_images); i++)
{
/* these ones are translated from glade3 */
glade_register_displayable_value (etype,
builtin_stock_images[i],
GETTEXT_PACKAGE,
builtin_stock_displayables[i]);
if (!glade_get_displayable_value (etype, builtin_stock_images[i]))
glade_register_displayable_value (etype,
builtin_stock_images[i],
GETTEXT_PACKAGE,
builtin_stock_displayables[i]);
}
}
return etype;
......@@ -395,15 +397,9 @@ param_objects_validate (GParamSpec * pspec, GValue * value)
{
object = list->data;
if (G_TYPE_IS_INTERFACE (ospec->type) &&
glade_util_class_implements_interface
(G_OBJECT_TYPE (object), ospec->type) == FALSE)
toremove = g_list_prepend (toremove, object);
else if (G_TYPE_IS_INTERFACE (ospec->type) == FALSE &&
g_type_is_a (G_OBJECT_TYPE (object), ospec->type) == FALSE)
if (!(G_OBJECT_TYPE (object) == ospec->type ||
g_type_is_a (G_OBJECT_TYPE (object), ospec->type)))
toremove = g_list_prepend (toremove, object);
}
for (list = toremove; list; list = list->next)
......
......@@ -1008,7 +1008,7 @@ get_all_parentless_reffed_widgets (GList * reffed, GladeWidget * widget)
* while newly added widgets will prefer packing defaults.
*
*/
static void
void
glade_command_add (GList *widgets,
GladeWidget *parent,
GladePlaceholder *placeholder,
......@@ -1066,11 +1066,11 @@ glade_command_add (GList *widgets,
/* Parent */
if (parent == NULL)
cdata->parent = glade_widget_get_parent (widget);
cdata->parent = glade_widget_get_parent (widget);
else if (placeholder && GWA_IS_TOPLEVEL (adaptor) == FALSE)
cdata->parent = glade_placeholder_get_parent (placeholder);
else if (GWA_IS_TOPLEVEL (adaptor) == FALSE)
cdata->parent = parent;
cdata->parent = glade_placeholder_get_parent (placeholder);
else
cdata->parent = parent;
/* Placeholder */
if (placeholder != NULL && g_list_length (widgets) == 1)
......@@ -1352,17 +1352,13 @@ glade_command_add_execute (GladeCommandAddRemove * me)
* there is only one widget.
*/
if (cdata->placeholder)
{
glade_widget_replace (cdata->parent,
G_OBJECT (cdata->placeholder),
glade_widget_get_object (cdata->widget));
}
glade_widget_replace (cdata->parent,
G_OBJECT (cdata->placeholder),
glade_widget_get_object (cdata->widget));
else
{
glade_widget_add_child (cdata->parent,
cdata->widget,
cdata->props_recorded == FALSE);
}
glade_widget_add_child (cdata->parent,
cdata->widget,
cdata->props_recorded == FALSE);
glade_command_transfer_props (cdata->widget, saved_props);
......@@ -1584,6 +1580,7 @@ glade_command_create (GladeWidgetAdaptor * adaptor, GladeWidget * parent,
{
return NULL;
}
widgets = g_list_prepend (widgets, widget);
glade_command_push_group (_("Create %s"), glade_widget_get_name (widget));
glade_command_add (widgets, parent, placeholder, project, FALSE);
......
......@@ -112,7 +112,14 @@ void glade_command_lock_widget (GladeWidget *widget,
void glade_command_unlock_widget (GladeWidget *widget);
/************************ create/delete ******************************/
/************************ create/add/delete ******************************/
void glade_command_add (GList *widgets,
GladeWidget *parent,
GladePlaceholder *placeholder,
GladeProject *project,
gboolean pasting);
void glade_command_delete (GList *widgets);
......
......@@ -495,10 +495,7 @@ glade_design_layout_add (GtkContainer * container, GtkWidget * widget)
static void
glade_design_layout_remove (GtkContainer * container, GtkWidget * widget)
{
/* Make sure toplevels dont "pop out" of the workspace */
gtk_widget_hide (widget);
GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->remove (container,
widget);
GTK_CONTAINER_CLASS (glade_design_layout_parent_class)->remove (container, widget);
gtk_widget_queue_draw (GTK_WIDGET (container));
}
......@@ -856,22 +853,22 @@ glade_design_layout_class_init (GladeDesignLayoutClass * klass)
klass->widget_event = glade_design_layout_widget_event_impl;
/**
* GladeDesignLayout::widget-event:
* @glade_design_layout: the #GladeDesignLayout containing the #GladeWidget.
* @signal_editor: the #GladeWidget which received the signal.
* @event: the #GdkEvent
*
* Emitted when a widget event received.
* Connect before the default handler to block glade logic,
* such as selecting or resizing, by returning #GLADE_WIDGET_EVENT_STOP_EMISSION.
* If you want to handle the event after it passed the glade logic,
* but before it reaches the widget, you should connect after the default handler.
*
* Returns: #GLADE_WIDGET_EVENT_STOP_EMISSION flag to abort futher emission of the signal.
* #GLADE_WIDGET_EVENT_RETURN_TRUE flag in the last handler
* to stop propagating of the event to the appropriate widget.
*/
/**
* GladeDesignLayout::widget-event:
* @glade_design_layout: the #GladeDesignLayout containing the #GladeWidget.
* @signal_editor: the #GladeWidget which received the signal.
* @event: the #GdkEvent
*
* Emitted when a widget event received.
* Connect before the default handler to block glade logic,
* such as selecting or resizing, by returning #GLADE_WIDGET_EVENT_STOP_EMISSION.
* If you want to handle the event after it passed the glade logic,
* but before it reaches the widget, you should connect after the default handler.
*
* Returns: #GLADE_WIDGET_EVENT_STOP_EMISSION flag to abort futher emission of the signal.
* #GLADE_WIDGET_EVENT_RETURN_TRUE flag in the last handler
* to stop propagating of the event to the appropriate widget.
*/
glade_design_layout_signals[WIDGET_EVENT] =
g_signal_new ("widget-event",
G_TYPE_FROM_CLASS (object_class),
......
......@@ -30,15 +30,76 @@
#include <string.h>
#include <stdlib.h>
#include "glade-project.h"
#include "glade-widget.h"
#include "glade-editable.h"
static GQuark glade_editable_project_quark = 0;
static GQuark glade_editable_widget_quark = 0;
static void
project_changed (GladeProject *project,
GladeCommand *command,
gboolean execute,
GladeEditable *editable)
{
GladeWidget *widget;
widget = g_object_get_qdata (G_OBJECT (editable), glade_editable_widget_quark);
glade_editable_load (editable, widget);
}
static void
project_closed (GladeProject *project,
GladeEditable *editable)
{
glade_editable_load (editable, NULL);
}
static void
glade_editable_load_default (GladeEditable *editable,
GladeWidget *widget)
{
GladeWidget *old_widget;
GladeProject *old_project;
old_widget = g_object_get_qdata (G_OBJECT (editable), glade_editable_widget_quark);
old_project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
if (old_widget != widget)
{
if (old_widget)
{
g_signal_handlers_disconnect_by_func (old_project, G_CALLBACK (project_changed), editable);
g_signal_handlers_disconnect_by_func (old_project, G_CALLBACK (project_closed), editable);
g_object_set_qdata (G_OBJECT (editable), glade_editable_widget_quark, NULL);
g_object_set_qdata (G_OBJECT (editable), glade_editable_project_quark, NULL);
}
if (widget)
{
GladeProject *project = glade_widget_get_project (widget);
g_object_set_qdata (G_OBJECT (editable), glade_editable_widget_quark, widget);
g_object_set_qdata (G_OBJECT (editable), glade_editable_project_quark, project);
g_signal_connect (project, "changed",
G_CALLBACK (project_changed), editable);
g_signal_connect (project, "close",
G_CALLBACK (project_closed), editable);
}
}
}
static void
glade_editable_class_init (gpointer g_iface)
glade_editable_class_init (GladeEditableIface *iface)
{
/* */
glade_editable_project_quark = g_quark_from_static_string ("glade-editable-project-quark");
glade_editable_widget_quark = g_quark_from_static_string ("glade-editable-widget-quark");
iface->load = glade_editable_load_default;
}
GType
......@@ -47,12 +108,15 @@ glade_editable_get_type (void)
static GType editable_type = 0;
if (!editable_type)
editable_type =
{
editable_type =
g_type_register_static_simple (G_TYPE_INTERFACE, "GladeEditable",
sizeof (GladeEditableIface),
(GClassInitFunc)
glade_editable_class_init, 0, NULL,
(GTypeFlags) 0);
g_type_interface_add_prerequisite (editable_type, GTK_TYPE_WIDGET);
}
return editable_type;
}
......@@ -104,3 +168,32 @@ glade_editable_set_show_name (GladeEditable * editable, gboolean show_name)
if (iface->set_show_name)
iface->set_show_name (editable, show_name);
}
void
glade_editable_block (GladeEditable *editable)
{
GladeProject *project;
g_return_if_fail (GLADE_IS_EDITABLE (editable));
project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
g_return_if_fail (GLADE_IS_PROJECT (project));
g_signal_handlers_block_by_func (project, G_CALLBACK (project_changed), editable);
}
void
glade_editable_unblock (GladeEditable *editable)
{
GladeProject *project;
g_return_if_fail (GLADE_IS_EDITABLE (editable));
project = g_object_get_qdata (G_OBJECT (editable), glade_editable_project_quark);
g_return_if_fail (GLADE_IS_PROJECT (project));
g_signal_handlers_unblock_by_func (project, G_CALLBACK (project_changed), editable);
}
......@@ -38,11 +38,15 @@ struct _GladeEditableIface
};
GType glade_editable_get_type (void) G_GNUC_CONST;
void glade_editable_load (GladeEditable *editable,
GladeWidget *widget);
void glade_editable_set_show_name (GladeEditable *editable,
gboolean show_name);
void glade_editable_block (GladeEditable *editable);
void glade_editable_unblock (GladeEditable *editable);
G_END_DECLS
......
......@@ -2480,13 +2480,11 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
{
adaptor = glade_widget_get_adaptor (widget);
has_decendant = !parentless && glade_widget_has_decendant
(widget, object_type);
has_decendant =
!parentless && glade_widget_has_decendant (widget, object_type);
good_type = (glade_widget_adaptor_get_object_type (adaptor) == object_type ||
g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type) ||
glade_util_class_implements_interface (glade_widget_adaptor_get_object_type (adaptor),
object_type));
g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type));
if (parentless)
good_type = good_type && !GWA_IS_TOPLEVEL (adaptor);
......@@ -2986,6 +2984,8 @@ glade_eprop_object_show_dialog (GtkWidget * dialog_button,
if (new_object && old_object != new_object)
{
glade_widget_hide (new_widget);
if ((old_ref =
glade_widget_get_parentless_widget_ref (new_widget)))
{
......
......@@ -893,6 +893,7 @@ glade_editor_query_dialog (GladeWidget * widget)
{
GladeWidgetAdaptor *adaptor;
GtkWidget *dialog, *editable, *content_area;
GtkWidget *create;
gchar *title;
gint answer;
gboolean retval = TRUE;
......@@ -906,9 +907,14 @@ glade_editor_query_dialog (GladeWidget * widget)
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
NULL);
g_free (title);
create = gtk_button_new_with_mnemonic (_("Crea_te"));
gtk_widget_show (create);
gtk_widget_set_can_default (create, TRUE);
gtk_dialog_add_action_widget (GTK_DIALOG (dialog), create, GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL, -1);
......
......@@ -349,11 +349,12 @@ search_entry_key_press_event_cb (GtkEntry * entry,
static void
widget_font_desc_set_style (GtkWidget * widget, PangoStyle style)
{
PangoFontDescription *font_desc =
pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
GtkStyleContext *context = gtk_widget_get_style_context (widget);
PangoFontDescription *font_desc =
pango_font_description_copy (gtk_style_context_get_font (context, GTK_STATE_FLAG_NORMAL));
pango_font_description_set_style (font_desc, style);
gtk_widget_modify_font (widget, font_desc);
gtk_widget_override_font (widget, font_desc);
pango_font_description_free (font_desc);
}
......@@ -373,12 +374,16 @@ search_entry_update (GladeInspector * inspector)
if (str[0] == '\0')
{
GtkStyleContext *context;
GdkRGBA color;
priv->search_disabled = TRUE;
widget_font_desc_set_style (priv->entry, PANGO_STYLE_ITALIC);
gtk_entry_set_text (GTK_ENTRY (priv->entry), _("< search widgets >"));
gtk_widget_modify_text (priv->entry, GTK_STATE_NORMAL,
&gtk_widget_get_style (priv->entry)->
text[GTK_STATE_INSENSITIVE]);
context = gtk_widget_get_style_context (priv->entry);
gtk_style_context_get_color (context, GTK_STATE_FLAG_INSENSITIVE, &color);
gtk_widget_override_color (priv->entry, GTK_STATE_FLAG_NORMAL, &color);
}
}
......@@ -391,8 +396,9 @@ search_entry_focus_in_cb (GtkWidget * entry,
if (priv->search_disabled)
{
gtk_entry_set_text (GTK_ENTRY (priv->entry), "");
gtk_widget_modify_text (priv->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_font (priv->entry, NULL);
gtk_widget_override_color (priv->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_override_font (priv->entry, NULL);
priv->search_disabled = FALSE;
}
......
......@@ -392,8 +392,6 @@ glade_placeholder_draw (GtkWidget * widget, cairo_t * cr)
glade_utils_cairo_draw_line (cr, dark, 0, h - 1, w - 1, h - 1);
glade_utils_cairo_draw_line (cr, dark, w - 1, 0, w - 1, h - 1);
glade_util_draw_selection_nodes (widget, cr);
return FALSE;
}
......
......@@ -54,7 +54,6 @@ glade_popup_docs_cb (GtkMenuItem * item, GladeWidgetAdaptor * adaptor)
static void
glade_popup_select_cb (GtkMenuItem * item, GladeWidget * widget)
{
glade_util_clear_selection ();
glade_project_selection_set (glade_widget_get_project (widget),
glade_widget_get_object (widget), TRUE);
}
......@@ -132,8 +131,6 @@ glade_popup_cut_cb (GtkMenuItem * item, GladeWidget * widget)
{
GladeProject *project = glade_widget_get_project (widget);
glade_util_clear_selection ();
/* Assign selection first only if its not already assigned (it may be a delete
* of multiple widgets) */
if (!glade_project_is_selected (project, glade_widget_get_object (widget)))
......@@ -147,10 +144,8 @@ glade_popup_copy_cb (GtkMenuItem * item, GladeWidget * widget)
{
GladeProject *project = glade_widget_get_project (widget);
glade_util_clear_selection ();
/* Assign selection first */
if (glade_project_is_selected (project, glade_widget_get_object (widget)) == FALSE)
if (!glade_project_is_selected (project, glade_widget_get_object (widget)))
glade_project_selection_set (project, glade_widget_get_object (widget), FALSE);
glade_project_copy_selection (project);
......@@ -172,8 +167,6 @@ glade_popup_paste_cb (GtkMenuItem * item, gpointer data)
else
g_return_if_reached ();
glade_util_clear_selection ();
/* The selected widget is the paste destination */
if (widget)
glade_project_selection_set (project, glade_widget_get_object (widget), FALSE);
......@@ -207,7 +200,6 @@ glade_popup_placeholder_paste_cb (GtkMenuItem * item,
project = glade_placeholder_get_project (placeholder);
glade_util_clear_selection ();
glade_project_selection_clear (project, FALSE);
glade_project_command_paste (project, placeholder);
......
......@@ -887,7 +887,7 @@ glade_project_class_init (GladeProjectClass * klass)
G_TYPE_NONE, 1, GLADE_TYPE_WIDGET);
/**
/**
* GladeProject::selection-changed:
* @gladeproject: the #GladeProject which received the signal.