From 1a32fc42506896eeae1c5ea7b34ab06a7f55fb35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20T=2E=20Colombini=20G=C3=B3mez?= Date: Fri, 10 Oct 2014 12:33:36 +0200 Subject: [PATCH] =?UTF-8?q?Cambios=20para=20adaptar=20el=20proyecto=20a=20?= =?UTF-8?q?la=20versi=C3=B3n=203.14=20de=20GTK+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- glade/glade-db-model-editor.c | 14 ++++++-------- glade/glade-db-model.c | 5 +++-- glade/glade-eprop-model.c | 24 +++++++++++++++--------- glade/glade-sql-batch.c | 20 ++++++++++---------- vn/field/vn-date-chooser.c | 2 +- vn/field/vn-label.c | 2 +- vn/vn-form.c | 2 +- vn/vn-form.h | 4 ++-- vn/vn-gui.c | 32 +++++++++++++++++--------------- vn/vn-gui.h | 2 -- 10 files changed, 56 insertions(+), 51 deletions(-) diff --git a/glade/glade-db-model-editor.c b/glade/glade-db-model-editor.c index 2a996c2..9a0d3e0 100644 --- a/glade/glade-db-model-editor.c +++ b/glade/glade-db-model-editor.c @@ -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); diff --git a/glade/glade-db-model.c b/glade/glade-db-model.c index e45194a..92e09df 100644 --- a/glade/glade-db-model.c +++ b/glade/glade-db-model.c @@ -593,8 +593,9 @@ static GtkWidget * glade_eprop_links_create_input (GladeEditorProperty * eprop) label = gtk_label_new (_("Add or remove links")); 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 (); diff --git a/glade/glade-eprop-model.c b/glade/glade-eprop-model.c index 52bbf05..0e8cdca 100644 --- a/glade/glade-eprop-model.c +++ b/glade/glade-eprop-model.c @@ -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)) { diff --git a/glade/glade-sql-batch.c b/glade/glade-sql-batch.c index 00779c1..8d704ed 100644 --- a/glade/glade-sql-batch.c +++ b/glade/glade-sql-batch.c @@ -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 (_("Add or remove items")); 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 (); diff --git a/vn/field/vn-date-chooser.c b/vn/field/vn-date-chooser.c index c24a668..cd979e8 100644 --- a/vn/field/vn-date-chooser.c +++ b/vn/field/vn-date-chooser.c @@ -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); diff --git a/vn/field/vn-label.c b/vn/field/vn-label.c index d7338de..3669ab1 100644 --- a/vn/field/vn-label.c +++ b/vn/field/vn-label.c @@ -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)); diff --git a/vn/vn-form.c b/vn/vn-form.c index c27b2f7..2b1c401 100644 --- a/vn/vn-form.c +++ b/vn/vn-form.c @@ -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 diff --git a/vn/vn-form.h b/vn/vn-form.h index ca9d80b..a873ad0 100644 --- a/vn/vn-form.h +++ b/vn/vn-form.h @@ -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); diff --git a/vn/vn-gui.c b/vn/vn-gui.c index 1b8fd07..098d92c 100644 --- a/vn/vn-gui.c +++ b/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) diff --git a/vn/vn-gui.h b/vn/vn-gui.h index 5f272c7..e9cb43f 100644 --- a/vn/vn-gui.h +++ b/vn/vn-gui.h @@ -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"