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,
|
||||
GladeEditable * editable)
|
||||
{
|
||||
GtkWidget * frame, * alignment, * vbox;
|
||||
GtkWidget * frame, * vbox;
|
||||
GladeEditorProperty * eprop;
|
||||
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_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);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
||||
gtk_widget_set_margin_top (vbox, 6);
|
||||
gtk_widget_set_margin_start (vbox, 12);
|
||||
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));
|
||||
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>"));
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_misc_set_padding (GTK_MISC (label), 2, 4);
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
gboolean created = FALSE;
|
||||
GtkWidget * box;
|
||||
// GtkWidget * box;
|
||||
GtkDialog * dialog;
|
||||
GladeWidget * widget;
|
||||
GladeWidgetAdaptor * adaptor;
|
||||
GladeEditable * editor;
|
||||
GtkWidget * editor;
|
||||
GladeProperty * p = glade_editor_property_get_property (eprop);
|
||||
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);
|
||||
editor = glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL);
|
||||
glade_editable_load (editor, widget);
|
||||
editor = GTK_WIDGET (glade_widget_adaptor_create_editable (adaptor, GLADE_PAGE_GENERAL));
|
||||
glade_editable_load (GLADE_EDITABLE (editor), widget);
|
||||
|
||||
dialog = GTK_DIALOG (gtk_dialog_new_with_buttons
|
||||
(_("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_window_set_default_size (GTK_WINDOW (dialog), 600, 500);
|
||||
|
||||
box = gtk_alignment_new (0,0,1,1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (box), 8, 8, 8, 8);
|
||||
gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (editor));
|
||||
gtk_widget_show_all (box);
|
||||
gtk_widget_set_halign (editor, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (editor, GTK_ALIGN_CENTER);
|
||||
|
||||
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)),
|
||||
box, TRUE, TRUE, 0);
|
||||
editor, TRUE, TRUE, 0);
|
||||
|
||||
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,
|
||||
GladeEditable * editable)
|
||||
{
|
||||
GtkWidget * frame, * alignment, * vbox;
|
||||
GtkWidget * frame, * vbox;
|
||||
GladeEditorProperty * eprop;
|
||||
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_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);
|
||||
gtk_container_add (GTK_CONTAINER (alignment), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (eprop), FALSE, FALSE, 4);
|
||||
gtk_widget_set_margin_top (vbox, 6);
|
||||
gtk_widget_set_margin_start (vbox, 12);
|
||||
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));
|
||||
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>"));
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_misc_set_padding (GTK_MISC (label), 2, 4);
|
||||
gtk_widget_set_margin_start (GTK_WIDGET (label), 2);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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));
|
||||
|
||||
self->popup = gtk_window_new (GTK_WINDOW_POPUP);
|
||||
|
|
|
@ -89,7 +89,7 @@ static void vn_label_init (VnLabel * self)
|
|||
{
|
||||
self->format = NULL;
|
||||
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_container_add (GTK_CONTAINER (self), GTK_WIDGET (self->label));
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "vn-form.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
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef void (* VnFormDeactivateFunc) (VnForm * obj);
|
|||
|
||||
struct _VnForm
|
||||
{
|
||||
GtkAlignment parent;
|
||||
GtkBin parent;
|
||||
gchar * name;
|
||||
VnGui * gui;
|
||||
DbConn * conn;
|
||||
|
@ -55,7 +55,7 @@ struct _VnForm
|
|||
**/
|
||||
struct _VnFormClass
|
||||
{
|
||||
GtkAlignmentClass parent;
|
||||
GtkBinClass parent;
|
||||
/*< public >*/
|
||||
void (* open) (VnForm * obj);
|
||||
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;
|
||||
GVariant * value;
|
||||
GVariant * target = NULL;
|
||||
const char * key;
|
||||
const char * accel = NULL;
|
||||
const char * action = NULL;
|
||||
const gchar * key;
|
||||
const gchar * accel = NULL;
|
||||
const gchar * action = NULL;
|
||||
const gchar * target = NULL;
|
||||
|
||||
iter = g_menu_model_iterate_item_attributes (model, item);
|
||||
|
||||
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);
|
||||
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);
|
||||
else if (g_str_equal (key, "target"))
|
||||
target = g_variant_ref (value);
|
||||
else if (g_str_equal (key, "target")
|
||||
&& g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
|
||||
target = g_variant_get_string (value, NULL);
|
||||
|
||||
g_variant_unref (value);
|
||||
}
|
||||
|
@ -403,14 +406,13 @@ static void set_accelerator (VnGui * obj, GMenuModel * model, gint item, gboolea
|
|||
|
||||
if (accel && action)
|
||||
{
|
||||
if (enable)
|
||||
gtk_application_add_accelerator (obj->app, accel, action, target);
|
||||
else
|
||||
gtk_application_remove_accelerator (obj->app, action, target);
|
||||
}
|
||||
gchar * detailed_action = g_strconcat (action, target ? "::" : NULL, target, NULL);
|
||||
const gchar * accelerator[] = {enable ? accel : NULL, NULL};
|
||||
|
||||
if (target)
|
||||
g_variant_unref (target);
|
||||
gtk_application_set_accels_for_action (obj->app, detailed_action, accelerator);
|
||||
|
||||
g_free (detailed_action);
|
||||
}
|
||||
}
|
||||
|
||||
static void vn_gui_set_menu_accels (VnGui * obj, GMenuModel * menu, gboolean enable)
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
typedef struct _VnGui VnGui;
|
||||
typedef struct _VnGuiClass VnGuiClass;
|
||||
|
||||
typedef struct _VnWindow VnWindow;
|
||||
|
||||
#include "vn-mod.h"
|
||||
#include "vn-form.h"
|
||||
#include "vn-window.h"
|
||||
|
|
Reference in New Issue