mirror of
https://gitlab.gnome.org/GNOME/glade.git
synced 2025-11-17 00:03:25 -05:00
Added GladeToolPaletteEditor
A very simple editor which just combines the basic GladeEditorTable with a GladeScrollableEditor
This commit is contained in:
parent
7ca7828200
commit
6edfe3ba81
@ -136,6 +136,7 @@ libgladegtk_la_SOURCES = \
|
||||
glade-text-view-editor.c \
|
||||
glade-tool-button-editor.c \
|
||||
glade-tool-item-group-editor.c \
|
||||
glade-tool-palette-editor.c \
|
||||
glade-treeview-editor.c \
|
||||
glade-widget-editor.c \
|
||||
glade-window-editor.c
|
||||
@ -205,6 +206,7 @@ noinst_HEADERS = \
|
||||
glade-text-view-editor.h \
|
||||
glade-tool-button-editor.h \
|
||||
glade-tool-item-group-editor.h \
|
||||
glade-tool-palette-editor.h \
|
||||
glade-treeview-editor.h \
|
||||
glade-widget-editor.h \
|
||||
glade-window-editor.h
|
||||
@ -269,6 +271,7 @@ UI_FILES = \
|
||||
glade-spin-button-editor.ui \
|
||||
glade-text-view-editor.ui \
|
||||
glade-tool-button-editor.ui \
|
||||
glade-tool-palette-editor.ui \
|
||||
glade-widget-editor.ui \
|
||||
glade-window-editor.ui
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-scrolled-window-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-spin-button-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-text-view-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-tool-palette-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-tool-button-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-widget-editor.ui</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">glade-window-editor.ui</file>
|
||||
|
||||
@ -25,15 +25,28 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gladeui/glade.h>
|
||||
|
||||
#include "glade-tool-palette-editor.h"
|
||||
#include "glade-gtk-menu-shell.h"
|
||||
#include "glade-gtk.h"
|
||||
|
||||
GladeEditable *
|
||||
glade_gtk_tool_palette_create_editable (GladeWidgetAdaptor * adaptor,
|
||||
GladeEditorPageType type)
|
||||
{
|
||||
if (type == GLADE_PAGE_GENERAL)
|
||||
{
|
||||
return (GladeEditable *)glade_tool_palette_editor_new ();
|
||||
}
|
||||
|
||||
return GWA_GET_CLASS (GTK_TYPE_CONTAINER)->create_editable (adaptor, type);
|
||||
}
|
||||
|
||||
void
|
||||
glade_gtk_tool_palette_get_child_property (GladeWidgetAdaptor * adaptor,
|
||||
GObject * container,
|
||||
GObject * child,
|
||||
const gchar * property_name,
|
||||
GValue * value)
|
||||
GObject * container,
|
||||
GObject * child,
|
||||
const gchar * property_name,
|
||||
GValue * value)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TOOL_PALETTE (container));
|
||||
if (GTK_IS_TOOL_ITEM_GROUP (child) == FALSE)
|
||||
|
||||
74
plugins/gtk+/glade-tool-palette-editor.c
Normal file
74
plugins/gtk+/glade-tool-palette-editor.c
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <gladeui/glade.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "glade-tool-palette-editor.h"
|
||||
|
||||
struct _GladeToolPaletteEditorPrivate
|
||||
{
|
||||
GtkWidget *embed;
|
||||
};
|
||||
|
||||
static void glade_tool_palette_editor_grab_focus (GtkWidget * widget);
|
||||
|
||||
G_DEFINE_TYPE (GladeToolPaletteEditor, glade_tool_palette_editor, GLADE_TYPE_EDITOR_SKELETON)
|
||||
|
||||
static void
|
||||
glade_tool_palette_editor_class_init (GladeToolPaletteEditorClass * klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->grab_focus = glade_tool_palette_editor_grab_focus;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/gladegtk/glade-tool-palette-editor.ui");
|
||||
gtk_widget_class_bind_child (widget_class, GladeToolPaletteEditorPrivate, embed);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GladeToolPaletteEditorPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_tool_palette_editor_init (GladeToolPaletteEditor * self)
|
||||
{
|
||||
self->priv =
|
||||
G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GLADE_TYPE_TOOL_PALETTE_EDITOR,
|
||||
GladeToolPaletteEditorPrivate);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
glade_tool_palette_editor_grab_focus (GtkWidget * widget)
|
||||
{
|
||||
GladeToolPaletteEditor *ppalette_editor = GLADE_TOOL_PALETTE_EDITOR (widget);
|
||||
|
||||
gtk_widget_grab_focus (ppalette_editor->priv->embed);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
glade_tool_palette_editor_new (void)
|
||||
{
|
||||
return g_object_new (GLADE_TYPE_TOOL_PALETTE_EDITOR, NULL);
|
||||
}
|
||||
57
plugins/gtk+/glade-tool-palette-editor.h
Normal file
57
plugins/gtk+/glade-tool-palette-editor.h
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Tristan Van Berkom.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as
|
||||
* published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Authors:
|
||||
* Tristan Van Berkom <tvb@gnome.org>
|
||||
*/
|
||||
#ifndef _GLADE_TOOL_PALETTE_EDITOR_H_
|
||||
#define _GLADE_TOOL_PALETTE_EDITOR_H_
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gladeui/glade.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GLADE_TYPE_TOOL_PALETTE_EDITOR (glade_tool_palette_editor_get_type ())
|
||||
#define GLADE_TOOL_PALETTE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GLADE_TYPE_TOOL_PALETTE_EDITOR, GladeToolPaletteEditor))
|
||||
#define GLADE_TOOL_PALETTE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GLADE_TYPE_TOOL_PALETTE_EDITOR, GladeToolPaletteEditorClass))
|
||||
#define GLADE_IS_TOOL_PALETTE_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GLADE_TYPE_TOOL_PALETTE_EDITOR))
|
||||
#define GLADE_IS_TOOL_PALETTE_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_TOOL_PALETTE_EDITOR))
|
||||
#define GLADE_TOOL_PALETTE_EDITOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GLADE_TYPE_TOOL_PALETTE_EDITOR, GladeToolPaletteEditorClass))
|
||||
|
||||
typedef struct _GladeToolPaletteEditor GladeToolPaletteEditor;
|
||||
typedef struct _GladeToolPaletteEditorClass GladeToolPaletteEditorClass;
|
||||
typedef struct _GladeToolPaletteEditorPrivate GladeToolPaletteEditorPrivate;
|
||||
|
||||
struct _GladeToolPaletteEditor
|
||||
{
|
||||
GladeEditorSkeleton parent;
|
||||
|
||||
GladeToolPaletteEditorPrivate *priv;
|
||||
};
|
||||
|
||||
struct _GladeToolPaletteEditorClass
|
||||
{
|
||||
GladeEditorSkeletonClass parent;
|
||||
};
|
||||
|
||||
GType glade_tool_palette_editor_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget *glade_tool_palette_editor_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* _GLADE_TOOL_PALETTE_EDITOR_H_ */
|
||||
38
plugins/gtk+/glade-tool-palette-editor.ui
Normal file
38
plugins/gtk+/glade-tool-palette-editor.ui
Normal file
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="glade">
|
||||
<!-- interface-requires glade-gtk-plugin 0.0 -->
|
||||
<!-- interface-requires gladeui 0.0 -->
|
||||
<template class="GladeToolPaletteEditor" parent="GladeEditorSkeleton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GladeEditorTable" id="embed">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GladeScrollableEditor" id="scrollable_editor">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child-editors>
|
||||
<editor id="embed"/>
|
||||
<editor id="scrollable_editor"/>
|
||||
</child-editors>
|
||||
</template>
|
||||
</interface>
|
||||
@ -746,6 +746,7 @@ embedded in another object</_tooltip>
|
||||
|
||||
<glade-widget-class name="GtkToolPalette" generic-name="toolpalette" _title="Tool Palette"
|
||||
use-placeholders="False" since="2.20">
|
||||
<create-editable-function>glade_gtk_tool_palette_create_editable</create-editable-function>
|
||||
<post-create-function>glade_gtk_toolbar_post_create</post-create-function>
|
||||
<add-child-verify-function>glade_gtk_tool_palette_add_verify</add-child-verify-function>
|
||||
<add-child-function>glade_gtk_tool_palette_add_child</add-child-function>
|
||||
@ -761,6 +762,20 @@ embedded in another object</_tooltip>
|
||||
<property id="icon-size-set" disabled="True"/>
|
||||
<property id="toolbar-style" save-always="True" optional="True" optional-default="False" weight="0.4"/>
|
||||
<property id="icon-size" optional="True" optional-default="False" weight="0.5"/>
|
||||
|
||||
<!-- Scrollable attributes -->
|
||||
<property id="hadjustment" custom-layout="True"/>
|
||||
<property id="vadjustment" custom-layout="True"/>
|
||||
<property id="hscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than minimum or natural width</_tooltip>
|
||||
<displayable-values>
|
||||
<value id="GTK_SCROLL_MINIMUM" _name="Minimum"/>
|
||||
<value id="GTK_SCROLL_NATURAL" _name="Natural"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="vscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than minimum or natural height</_tooltip>
|
||||
</property>
|
||||
</properties>
|
||||
|
||||
<packing-properties>
|
||||
@ -1164,19 +1179,6 @@ embedded in another object</_tooltip>
|
||||
<property id="pixels-above-lines" custom-layout="True"/>
|
||||
<property id="pixels-below-lines" custom-layout="True"/>
|
||||
<property id="pixels-inside-wrap" custom-layout="True"/>
|
||||
<property id="hadjustment" custom-layout="True"/>
|
||||
<property id="vadjustment" custom-layout="True"/>
|
||||
|
||||
<property id="hscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than Minimum or Natural width</_tooltip>
|
||||
<displayable-values>
|
||||
<value id="GTK_SCROLL_MINIMUM" _name="Minimum"/>
|
||||
<value id="GTK_SCROLL_NATURAL" _name="Natural"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
<property id="vscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than Minimum or Natural height</_tooltip>
|
||||
</property>
|
||||
|
||||
<property id="wrap-mode" custom-layout="True">
|
||||
<displayable-values>
|
||||
@ -1186,6 +1188,16 @@ embedded in another object</_tooltip>
|
||||
<value id="GTK_WRAP_WORD_CHAR" _name="Word Character"/>
|
||||
</displayable-values>
|
||||
</property>
|
||||
|
||||
<!-- Scrollable attributes -->
|
||||
<property id="hadjustment" custom-layout="True"/>
|
||||
<property id="vadjustment" custom-layout="True"/>
|
||||
<property id="hscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than minimum or natural width</_tooltip>
|
||||
</property>
|
||||
<property id="vscroll-policy" custom-layout="True">
|
||||
<_tooltip>Whether to start scrolling at less than minimum or natural height</_tooltip>
|
||||
</property>
|
||||
</properties>
|
||||
</glade-widget-class>
|
||||
|
||||
|
||||
@ -207,5 +207,6 @@ plugins/gtk+/gtk+.xml.in
|
||||
[type: gettext/glade]plugins/gtk+/glade-spin-button-editor.ui
|
||||
[type: gettext/glade]plugins/gtk+/glade-text-view-editor.ui
|
||||
[type: gettext/glade]plugins/gtk+/glade-tool-button-editor.ui
|
||||
[type: gettext/glade]plugins/gtk+/glade-tool-palette-editor.ui
|
||||
[type: gettext/glade]plugins/gtk+/glade-widget-editor.ui
|
||||
[type: gettext/glade]plugins/gtk+/glade-window-editor.ui
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user