Cambios para adaptar el proyecto a la versión 3.14 de GTK+
This commit is contained in:
parent
50aa45d7d2
commit
1a32fc4250
|
@ -22,7 +22,7 @@
|
||||||
GtkWidget * glade_model_editor_new (GladeWidgetAdaptor * adaptor,
|
GtkWidget * glade_model_editor_new (GladeWidgetAdaptor * adaptor,
|
||||||
GladeEditable * editable)
|
GladeEditable * editable)
|
||||||
{
|
{
|
||||||
GtkWidget * frame, * alignment, * vbox;
|
GtkWidget * frame, * vbox;
|
||||||
GladeEditorProperty * eprop;
|
GladeEditorProperty * eprop;
|
||||||
GladeModelEditor * obj;
|
GladeModelEditor * obj;
|
||||||
|
|
||||||
|
@ -43,15 +43,13 @@ GtkWidget * glade_model_editor_new (GladeWidgetAdaptor * adaptor,
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
||||||
gtk_box_pack_start (GTK_BOX (obj), frame, FALSE, FALSE, 12);
|
gtk_box_pack_start (GTK_BOX (obj), frame, FALSE, FALSE, 12);
|
||||||
|
|
||||||
alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
gtk_widget_set_margin_top (vbox, 6);
|
||||||
|
gtk_widget_set_margin_start (vbox, 12);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
|
||||||
gtk_widget_set_tooltip_text (vbox, _("List of parameters linked to the model"));
|
gtk_widget_set_tooltip_text (vbox, _("List of parameters linked to the model"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_WIDGET (obj));
|
gtk_widget_show_all (GTK_WIDGET (obj));
|
||||||
return GTK_WIDGET (obj);
|
return GTK_WIDGET (obj);
|
||||||
|
|
|
@ -593,8 +593,9 @@ static GtkWidget * glade_eprop_links_create_input (GladeEditorProperty * eprop)
|
||||||
|
|
||||||
label = gtk_label_new (_("<b>Add or remove links</b>"));
|
label = gtk_label_new (_("<b>Add or remove links</b>"));
|
||||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||||
gtk_misc_set_padding (GTK_MISC (label), 2, 4);
|
gtk_widget_set_margin_start (label, 2);
|
||||||
|
gtk_widget_set_margin_top (label, 4);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
|
|
|
@ -100,11 +100,11 @@ static GladeWidget * glade_model_create (GladeProperty * prop)
|
||||||
static void glade_eprop_model_show_dialog (GtkButton * button, GladeEditorProperty * eprop)
|
static void glade_eprop_model_show_dialog (GtkButton * button, GladeEditorProperty * eprop)
|
||||||
{
|
{
|
||||||
gboolean created = FALSE;
|
gboolean created = FALSE;
|
||||||
GtkWidget * box;
|
// GtkWidget * box;
|
||||||
GtkDialog * dialog;
|
GtkDialog * dialog;
|
||||||
GladeWidget * widget;
|
GladeWidget * widget;
|
||||||
GladeWidgetAdaptor * adaptor;
|
GladeWidgetAdaptor * adaptor;
|
||||||
GladeEditable * editor;
|
GtkWidget * editor;
|
||||||
GladeProperty * p = glade_editor_property_get_property (eprop);
|
GladeProperty * p = glade_editor_property_get_property (eprop);
|
||||||
GObject * o = g_value_get_object (glade_property_inline_value (p));
|
GObject * o = g_value_get_object (glade_property_inline_value (p));
|
||||||
|
|
||||||
|
@ -140,8 +140,8 @@ static void glade_eprop_model_show_dialog (GtkButton * button, GladeEditorProper
|
||||||
}
|
}
|
||||||
|
|
||||||
adaptor = glade_widget_get_adaptor (widget);
|
adaptor = glade_widget_get_adaptor (widget);
|
||||||
editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
|
editor = GTK_WIDGET (glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL));
|
||||||
glade_editable_load (editor, widget);
|
glade_editable_load (GLADE_EDITABLE (editor), widget);
|
||||||
|
|
||||||
dialog = GTK_DIALOG (gtk_dialog_new_with_buttons
|
dialog = GTK_DIALOG (gtk_dialog_new_with_buttons
|
||||||
(_("Model configuration")
|
(_("Model configuration")
|
||||||
|
@ -155,12 +155,18 @@ static void glade_eprop_model_show_dialog (GtkButton * button, GladeEditorProper
|
||||||
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
|
gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK);
|
||||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
|
gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
|
||||||
|
|
||||||
box = gtk_alignment_new (0,0,1,1);
|
gtk_widget_set_halign (editor, GTK_ALIGN_FILL);
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (box), 8, 8, 8, 8);
|
gtk_widget_set_valign (editor, GTK_ALIGN_CENTER);
|
||||||
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (editor));
|
|
||||||
gtk_widget_show_all (box);
|
gtk_widget_set_margin_top (editor, 8);
|
||||||
|
gtk_widget_set_margin_bottom (editor, 8);
|
||||||
|
gtk_widget_set_margin_start (editor, 8);
|
||||||
|
gtk_widget_set_margin_end (editor, 8);
|
||||||
|
|
||||||
|
gtk_widget_show_all (editor);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)),
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (dialog)),
|
||||||
box, TRUE, TRUE, 0);
|
editor, TRUE, TRUE, 0);
|
||||||
|
|
||||||
switch (gtk_dialog_run (dialog))
|
switch (gtk_dialog_run (dialog))
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,7 @@ GType glade_batch_editor_get_type (void) G_GNUC_CONST;
|
||||||
static GtkWidget * glade_sql_batch_editor_new (GladeWidgetAdaptor * adaptor,
|
static GtkWidget * glade_sql_batch_editor_new (GladeWidgetAdaptor * adaptor,
|
||||||
GladeEditable * editable)
|
GladeEditable * editable)
|
||||||
{
|
{
|
||||||
GtkWidget * frame, * alignment, * vbox;
|
GtkWidget * frame, * vbox;
|
||||||
GladeEditorProperty * eprop;
|
GladeEditorProperty * eprop;
|
||||||
GladeBatchEditor * obj;
|
GladeBatchEditor * obj;
|
||||||
|
|
||||||
|
@ -68,15 +68,13 @@ static GtkWidget * glade_sql_batch_editor_new (GladeWidgetAdaptor * adaptor,
|
||||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
|
||||||
gtk_box_pack_start (GTK_BOX (obj), frame, FALSE, FALSE, 12);
|
gtk_box_pack_start (GTK_BOX (obj), frame, FALSE, FALSE, 12);
|
||||||
|
|
||||||
alignment = gtk_alignment_new (0.5F, 0.5F, 1.0F, 1.0F);
|
|
||||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 6, 0, 12, 0);
|
|
||||||
gtk_container_add (GTK_CONTAINER (frame), alignment);
|
|
||||||
|
|
||||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
gtk_widget_set_margin_top (vbox, 6);
|
||||||
|
gtk_widget_set_margin_start (vbox, 12);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
|
||||||
gtk_widget_set_tooltip_text (vbox, _("List of items"));
|
gtk_widget_set_tooltip_text (vbox, _("List of items"));
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
||||||
|
|
||||||
|
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_WIDGET (obj));
|
gtk_widget_show_all (GTK_WIDGET (obj));
|
||||||
return GTK_WIDGET (obj);
|
return GTK_WIDGET (obj);
|
||||||
|
@ -400,8 +398,10 @@ static GtkWidget * glade_eprop_items_create_input (GladeEditorProperty * eprop)
|
||||||
|
|
||||||
label = gtk_label_new (_("<b>Add or remove items</b>"));
|
label = gtk_label_new (_("<b>Add or remove items</b>"));
|
||||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
gtk_widget_set_margin_start (GTK_WIDGET (label), 2);
|
||||||
gtk_misc_set_padding (GTK_MISC (label), 2, 4);
|
gtk_widget_set_margin_end (GTK_WIDGET (label), 2);
|
||||||
|
gtk_widget_set_margin_top (GTK_WIDGET (label), 4);
|
||||||
|
gtk_widget_set_margin_bottom (GTK_WIDGET (label), 4);
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
|
|
||||||
button = gtk_button_new ();
|
button = gtk_button_new ();
|
||||||
|
|
|
@ -430,7 +430,7 @@ static void vn_date_chooser_init (VnDateChooser * self)
|
||||||
g_object_set (self->button, "relief", GTK_RELIEF_HALF, NULL);
|
g_object_set (self->button, "relief", GTK_RELIEF_HALF, NULL);
|
||||||
|
|
||||||
self->label = GTK_LABEL (gtk_label_new (NULL));
|
self->label = GTK_LABEL (gtk_label_new (NULL));
|
||||||
gtk_misc_set_alignment (GTK_MISC (self->label), 0, 0.5);
|
gtk_widget_set_halign (GTK_WIDGET (self->label), GTK_ALIGN_START);
|
||||||
gtk_container_add (GTK_CONTAINER (self->button), GTK_WIDGET (self->label));
|
gtk_container_add (GTK_CONTAINER (self->button), GTK_WIDGET (self->label));
|
||||||
|
|
||||||
self->popup = gtk_window_new (GTK_WINDOW_POPUP);
|
self->popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||||
|
|
|
@ -89,7 +89,7 @@ static void vn_label_init (VnLabel * self)
|
||||||
{
|
{
|
||||||
self->format = NULL;
|
self->format = NULL;
|
||||||
self->label = GTK_LABEL (gtk_label_new (""));
|
self->label = GTK_LABEL (gtk_label_new (""));
|
||||||
gtk_misc_set_alignment (GTK_MISC (self->label), 0, 0.5);
|
gtk_widget_set_halign (GTK_WIDGET (self->label), GTK_ALIGN_START);
|
||||||
gtk_widget_show (GTK_WIDGET (self->label));
|
gtk_widget_show (GTK_WIDGET (self->label));
|
||||||
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->label));
|
gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->label));
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "vn-form.h"
|
#include "vn-form.h"
|
||||||
#include "vn-set.h"
|
#include "vn-set.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (VnForm, vn_form, GTK_TYPE_ALIGNMENT);
|
G_DEFINE_ABSTRACT_TYPE (VnForm, vn_form, GTK_TYPE_BIN);
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++ Public
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef void (* VnFormDeactivateFunc) (VnForm * obj);
|
||||||
|
|
||||||
struct _VnForm
|
struct _VnForm
|
||||||
{
|
{
|
||||||
GtkAlignment parent;
|
GtkBin parent;
|
||||||
gchar * name;
|
gchar * name;
|
||||||
VnGui * gui;
|
VnGui * gui;
|
||||||
DbConn * conn;
|
DbConn * conn;
|
||||||
|
@ -55,7 +55,7 @@ struct _VnForm
|
||||||
**/
|
**/
|
||||||
struct _VnFormClass
|
struct _VnFormClass
|
||||||
{
|
{
|
||||||
GtkAlignmentClass parent;
|
GtkBinClass parent;
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
void (* open) (VnForm * obj);
|
void (* open) (VnForm * obj);
|
||||||
const GActionEntry * (* get_actions) (VnForm * obj, gint * size);
|
const GActionEntry * (* get_actions) (VnForm * obj, gint * size);
|
||||||
|
|
32
vn/vn-gui.c
32
vn/vn-gui.c
|
@ -380,21 +380,24 @@ static void set_accelerator (VnGui * obj, GMenuModel * model, gint item, gboolea
|
||||||
{
|
{
|
||||||
GMenuAttributeIter * iter;
|
GMenuAttributeIter * iter;
|
||||||
GVariant * value;
|
GVariant * value;
|
||||||
GVariant * target = NULL;
|
const gchar * key;
|
||||||
const char * key;
|
const gchar * accel = NULL;
|
||||||
const char * accel = NULL;
|
const gchar * action = NULL;
|
||||||
const char * action = NULL;
|
const gchar * target = NULL;
|
||||||
|
|
||||||
iter = g_menu_model_iterate_item_attributes (model, item);
|
iter = g_menu_model_iterate_item_attributes (model, item);
|
||||||
|
|
||||||
while (g_menu_attribute_iter_get_next (iter, &key, &value))
|
while (g_menu_attribute_iter_get_next (iter, &key, &value))
|
||||||
{
|
{
|
||||||
if (g_str_equal (key, "action") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
if (g_str_equal (key, "action")
|
||||||
|
&& g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
action = g_variant_get_string (value, NULL);
|
action = g_variant_get_string (value, NULL);
|
||||||
else if (g_str_equal (key, "accel") && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
else if (g_str_equal (key, "accel")
|
||||||
|
&& g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
accel = g_variant_get_string (value, NULL);
|
accel = g_variant_get_string (value, NULL);
|
||||||
else if (g_str_equal (key, "target"))
|
else if (g_str_equal (key, "target")
|
||||||
target = g_variant_ref (value);
|
&& g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||||
|
target = g_variant_get_string (value, NULL);
|
||||||
|
|
||||||
g_variant_unref (value);
|
g_variant_unref (value);
|
||||||
}
|
}
|
||||||
|
@ -403,14 +406,13 @@ static void set_accelerator (VnGui * obj, GMenuModel * model, gint item, gboolea
|
||||||
|
|
||||||
if (accel && action)
|
if (accel && action)
|
||||||
{
|
{
|
||||||
if (enable)
|
gchar * detailed_action = g_strconcat (action, target ? "::" : NULL, target, NULL);
|
||||||
gtk_application_add_accelerator (obj->app, accel, action, target);
|
const gchar * accelerator[] = {enable ? accel : NULL, NULL};
|
||||||
else
|
|
||||||
gtk_application_remove_accelerator (obj->app, action, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target)
|
gtk_application_set_accels_for_action (obj->app, detailed_action, accelerator);
|
||||||
g_variant_unref (target);
|
|
||||||
|
g_free (detailed_action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vn_gui_set_menu_accels (VnGui * obj, GMenuModel * menu, gboolean enable)
|
static void vn_gui_set_menu_accels (VnGui * obj, GMenuModel * menu, gboolean enable)
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
typedef struct _VnGui VnGui;
|
typedef struct _VnGui VnGui;
|
||||||
typedef struct _VnGuiClass VnGuiClass;
|
typedef struct _VnGuiClass VnGuiClass;
|
||||||
|
|
||||||
typedef struct _VnWindow VnWindow;
|
|
||||||
|
|
||||||
#include "vn-mod.h"
|
#include "vn-mod.h"
|
||||||
#include "vn-form.h"
|
#include "vn-form.h"
|
||||||
#include "vn-window.h"
|
#include "vn-window.h"
|
||||||
|
|
Reference in New Issue