From: Jim Evins Date: Mon, 20 May 2013 01:26:32 +0000 (-0700) Subject: Fixed low hanging deprecations and warnings. X-Git-Tag: glabels-3_2_0~26 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=748c4120718803a54040400e074db7fd250fc813;p=glabels Fixed low hanging deprecations and warnings. --- diff --git a/src/color-combo-button.c b/src/color-combo-button.c index 8a5e988d..11b304c6 100644 --- a/src/color-combo-button.c +++ b/src/color-combo-button.c @@ -138,7 +138,7 @@ gl_color_combo_button_init (glColorComboButton *this) this->priv = g_new0 (glColorComboButtonPrivate, 1); - this->priv->button_vbox = gtk_vbox_new (FALSE, 0); + this->priv->button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); this->priv->button = gtk_toggle_button_new (); gtk_container_add (GTK_CONTAINER (this->priv->button), this->priv->button_vbox); @@ -339,7 +339,7 @@ menu_position_function (GtkMenu *menu, /* * Size of menu. */ - gtk_widget_size_request (this->priv->menu, &menu_requisition); + gtk_widget_get_preferred_size (this->priv->menu, NULL, &menu_requisition); h_menu = menu_requisition.height; w_menu = menu_requisition.width; diff --git a/src/color-combo.c b/src/color-combo.c index ea29ebe1..d2ec63ec 100644 --- a/src/color-combo.c +++ b/src/color-combo.c @@ -129,7 +129,7 @@ gl_color_combo_init (glColorCombo *this) this->priv = g_new0 (glColorComboPrivate, 1); - hbox = gtk_hbox_new (FALSE, 3); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_container_add (GTK_CONTAINER (this), hbox); this->priv->swatch = gl_color_swatch_new (IMAGE_W, IMAGE_H, GL_COLOR_NONE); @@ -277,7 +277,7 @@ menu_position_function (GtkMenu *menu, /* * Size of menu. */ - gtk_widget_size_request (this->priv->menu, &menu_requisition); + gtk_widget_get_preferred_size (this->priv->menu, NULL, &menu_requisition); h_menu = menu_requisition.height; w_menu = menu_requisition.width; diff --git a/src/field-button.c b/src/field-button.c index 8b8c4e5b..98a803c1 100644 --- a/src/field-button.c +++ b/src/field-button.c @@ -129,7 +129,7 @@ gl_field_button_init (glFieldButton *this) this->priv = g_new0 (glFieldButtonPrivate, 1); - hbox = gtk_hbox_new (FALSE, 3); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_container_add (GTK_CONTAINER (this), hbox); this->priv->label = gtk_label_new (""); @@ -283,7 +283,7 @@ menu_position_function (GtkMenu *menu, /* * Size of menu. */ - gtk_widget_size_request (this->priv->menu, &menu_requisition); + gtk_widget_get_preferred_size (this->priv->menu, NULL, &menu_requisition); h_menu = menu_requisition.height; w_menu = menu_requisition.width; diff --git a/src/font-combo-menu-item.c b/src/font-combo-menu-item.c index 6d958d6d..1f125188 100644 --- a/src/font-combo-menu-item.c +++ b/src/font-combo-menu-item.c @@ -142,7 +142,7 @@ gl_font_combo_menu_item_new (gchar *font_family) this->priv->font_family = g_strdup (font_family); - hbox = gtk_hbox_new (FALSE, 6); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); gtk_container_add (GTK_CONTAINER (this), hbox); sample = gl_font_sample_new (SAMPLE_W, SAMPLE_H, short_sample_text, font_family); diff --git a/src/font-combo.c b/src/font-combo.c index 3c9480f5..cf24d9de 100644 --- a/src/font-combo.c +++ b/src/font-combo.c @@ -118,7 +118,7 @@ gl_font_combo_init (glFontCombo *this) this->priv = g_new0 (glFontComboPrivate, 1); - hbox = gtk_hbox_new (FALSE, 3); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3); gtk_container_add (GTK_CONTAINER (this), hbox); this->priv->label = gtk_label_new (""); @@ -258,7 +258,7 @@ menu_position_function (GtkMenu *menu, /* * Size of menu. */ - gtk_widget_size_request (this->priv->menu, &menu_requisition); + gtk_widget_get_preferred_size (this->priv->menu, NULL, &menu_requisition); h_menu = menu_requisition.height; w_menu = menu_requisition.width; diff --git a/src/font-util.c b/src/font-util.c index a9c67e96..88ecf119 100644 --- a/src/font-util.c +++ b/src/font-util.c @@ -46,7 +46,7 @@ gl_font_util_get_all_families (void) if ( !list ) { fontmap = pango_cairo_font_map_new (); - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_font_map_create_context (PANGO_FONT_MAP (fontmap)); pango_context_list_families (context, &families, &n); @@ -84,7 +84,7 @@ gl_font_util_get_proportional_families (void) if ( !list ) { fontmap = pango_cairo_font_map_new (); - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_font_map_create_context (PANGO_FONT_MAP (fontmap)); pango_context_list_families (context, &families, &n); @@ -125,7 +125,7 @@ gl_font_util_get_fixed_width_families (void) if ( !list ) { fontmap = pango_cairo_font_map_new (); - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_font_map_create_context (PANGO_FONT_MAP (fontmap)); pango_context_list_families (context, &families, &n); diff --git a/src/label-image.c b/src/label-image.c index f5e45855..4a64f203 100644 --- a/src/label-image.c +++ b/src/label-image.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "pixbuf-util.h" #include "file-util.h" diff --git a/src/label-object.c b/src/label-object.c index 8d48e53a..987f1b54 100644 --- a/src/label-object.c +++ b/src/label-object.c @@ -381,8 +381,6 @@ gl_label_object_set_position (glLabelObject *object, gdouble y, gboolean checkpoint) { - gdouble dx, dy; - gl_debug (DEBUG_LABEL, "START"); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); @@ -394,9 +392,6 @@ gl_label_object_set_position (glLabelObject *object, gl_label_checkpoint (object->priv->parent, _("Move")); } - dx = x - object->priv->x; - dy = y - object->priv->y; - object->priv->x = x; object->priv->y = y; diff --git a/src/label-text.c b/src/label-text.c index d51e3000..3f0305f9 100644 --- a/src/label-text.c +++ b/src/label-text.c @@ -531,7 +531,7 @@ get_size (glLabelObject *object, fontmap = pango_cairo_font_map_new (); - context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap)); + context = pango_font_map_create_context (PANGO_FONT_MAP (fontmap)); options = cairo_font_options_create (); cairo_font_options_set_hint_style (options, CAIRO_HINT_STYLE_NONE); cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_OFF); diff --git a/src/label.h b/src/label.h index 0d593730..f93f6f4e 100644 --- a/src/label.h +++ b/src/label.h @@ -240,6 +240,9 @@ void gl_label_set_selection_font_italic_flag (glLabel *label, void gl_label_set_selection_text_alignment (glLabel *label, PangoAlignment text_alignment); +void gl_label_set_selection_text_valignment (glLabel *label, + glValignment text_valignment); + void gl_label_set_selection_text_line_spacing (glLabel *label, gdouble text_line_spacing); diff --git a/src/merge-text.c b/src/merge-text.c index 4c1f7123..c60b2690 100644 --- a/src/merge-text.c +++ b/src/merge-text.c @@ -90,7 +90,6 @@ static void gl_merge_text_copy (glMerge *dst_merge static GList *parse_line (FILE *fp, gchar delim); -static gchar *parse_field (gchar *raw_field); static void free_fields (GList **fields); @@ -189,7 +188,7 @@ gl_merge_text_set_property (GObject *object, switch (param_id) { case ARG_DELIM: - merge_text->priv->delim = g_value_get_char (value); + merge_text->priv->delim = g_value_get_schar (value); gl_debug (DEBUG_MERGE, "ARG \"delim\" = \"%c\"", merge_text->priv->delim); break; @@ -225,7 +224,7 @@ gl_merge_text_get_property (GObject *object, switch (param_id) { case ARG_DELIM: - g_value_set_char (value, merge_text->priv->delim); + g_value_set_schar (value, merge_text->priv->delim); break; case ARG_LINE1_HAS_KEYS: diff --git a/src/mini-preview.c b/src/mini-preview.c index dc92d6e4..8e64d60c 100644 --- a/src/mini-preview.c +++ b/src/mini-preview.c @@ -632,7 +632,6 @@ button_press_event_cb (GtkWidget *widget, glMiniPreview *this = GL_MINI_PREVIEW (widget); GdkWindow *window; cairo_t *cr; - gdouble scale; gdouble x, y; gint i; @@ -645,7 +644,7 @@ button_press_event_cb (GtkWidget *widget, cr = gdk_cairo_create (window); - scale = set_transform_and_get_scale (this, cr); + set_transform_and_get_scale (this, cr); x = event->x; y = event->y; @@ -684,7 +683,6 @@ motion_notify_event_cb (GtkWidget *widget, glMiniPreview *this = GL_MINI_PREVIEW (widget); GdkWindow *window; cairo_t *cr; - gdouble scale; gdouble x, y; gint i; @@ -696,7 +694,7 @@ motion_notify_event_cb (GtkWidget *widget, cr = gdk_cairo_create (window); - scale = set_transform_and_get_scale (this, cr); + set_transform_and_get_scale (this, cr); x = event->x; y = event->y; @@ -979,7 +977,7 @@ draw_labels (glMiniPreview *this, lglTemplateOrigin *origins; GtkStyle *style; guint base_color; - guint highlight_color, paper_color, outline_color; + guint highlight_color, outline_color; gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -991,7 +989,6 @@ draw_labels (glMiniPreview *this, style = gtk_widget_get_style (GTK_WIDGET(this)); base_color = gl_color_from_gdk_color (&style->base[GTK_STATE_SELECTED]); - paper_color = gl_color_from_gdk_color (&style->light[GTK_STATE_NORMAL]); highlight_color = gl_color_set_opacity (base_color, 0.10); if (this->priv->label) { diff --git a/src/str-util.h b/src/str-util.h index 76dda779..1451c8fb 100644 --- a/src/str-util.h +++ b/src/str-util.h @@ -24,11 +24,16 @@ #include #include +#include "label-object.h" + G_BEGIN_DECLS const gchar *gl_str_util_align_to_string (PangoAlignment align); PangoAlignment gl_str_util_string_to_align (const gchar *string); +const gchar *gl_str_util_valign_to_string (glValignment valign); +glValignment gl_str_util_string_to_valign (const gchar *string); + const gchar *gl_str_util_weight_to_string (PangoWeight weight); PangoWeight gl_str_util_string_to_weight (const gchar *string); diff --git a/src/ui-property-bar.c b/src/ui-property-bar.c index e4eba227..dec3a0be 100644 --- a/src/ui-property-bar.c +++ b/src/ui-property-bar.c @@ -26,6 +26,7 @@ #include #include +#include "label.h" #include "builder-util.h" #include "font-combo.h" #include "color-combo-button.h" diff --git a/src/view.c b/src/view.c index 020713db..23eda524 100644 --- a/src/view.c +++ b/src/view.c @@ -597,8 +597,8 @@ size_allocate_cb (glView *view, gl_debug (DEBUG_VIEW, "START"); - hadjustment = gtk_layout_get_hadjustment(GTK_LAYOUT (view->canvas)); - vadjustment = gtk_layout_get_vadjustment(GTK_LAYOUT (view->canvas)); + hadjustment = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE (view->canvas)); + vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (view->canvas)); gtk_adjustment_set_page_size( hadjustment, allocation->width); gtk_adjustment_set_page_increment( hadjustment, allocation->width / 2); @@ -669,8 +669,8 @@ label_resized_cb (glView *view) gl_debug (DEBUG_VIEW, "START"); - hadjustment = gtk_layout_get_hadjustment(GTK_LAYOUT (view->canvas)); - vadjustment = gtk_layout_get_vadjustment(GTK_LAYOUT (view->canvas)); + hadjustment = gtk_scrollable_get_hadjustment(GTK_SCROLLABLE (view->canvas)); + vadjustment = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE (view->canvas)); g_signal_emit_by_name (hadjustment, "changed"); g_signal_emit_by_name (vadjustment, "changed"); @@ -1062,7 +1062,7 @@ gl_view_arrow_mode (glView *view) cursor = gdk_cursor_new (GDK_LEFT_PTR); gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (G_OBJECT (cursor)); view->mode = GL_VIEW_MODE_ARROW; view->state = GL_VIEW_IDLE; @@ -1113,7 +1113,7 @@ gl_view_object_create_mode (glView *view, } gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (G_OBJECT (cursor)); view->mode = GL_VIEW_MODE_OBJECT_CREATE; view->state = GL_VIEW_IDLE; @@ -1437,7 +1437,7 @@ motion_notify_event_cb (glView *view, cursor = gdk_cursor_new (GDK_LEFT_PTR); } gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (G_OBJECT (cursor)); break; case GL_VIEW_ARROW_SELECT_REGION: @@ -1788,7 +1788,7 @@ button_release_event_cb (glView *view, view->state = GL_VIEW_IDLE; cursor = gdk_cursor_new (GDK_LEFT_PTR); gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (G_OBJECT (cursor)); gl_label_select_object (view->label, view->create_object); break; @@ -1846,7 +1846,7 @@ key_press_event_cb (glView *view, gl_label_delete_selection (view->label); cursor = gdk_cursor_new (GDK_LEFT_PTR); gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (G_OBJECT (cursor)); break; default: return FALSE; diff --git a/src/window.c b/src/window.c index f2883dc0..ca39c4fd 100644 --- a/src/window.c +++ b/src/window.c @@ -140,7 +140,7 @@ gl_window_init (glWindow *window) gl_debug (DEBUG_WINDOW, "START"); - vbox1 = gtk_vbox_new (FALSE, 0); + vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (window), vbox1); window->ui = ui = gl_ui_new (window); @@ -154,7 +154,7 @@ gl_window_init (glWindow *window) gtk_ui_manager_get_widget (ui, "/DrawingToolBar"), FALSE, FALSE, 0); - window->hbox = gtk_hbox_new (FALSE, 0); + window->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (vbox1), window->hbox, TRUE, TRUE, 0); window->sidebar = GL_UI_SIDEBAR (gl_ui_sidebar_new ()); @@ -163,7 +163,7 @@ gl_window_init (glWindow *window) window->property_bar = GL_UI_PROPERTY_BAR (gl_ui_property_bar_new ()); gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (window->property_bar), FALSE, FALSE, 0); - status_hbox = gtk_hbox_new (FALSE, 0); + status_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (vbox1), status_hbox, FALSE, FALSE, 0); window->status_bar = gtk_statusbar_new (); diff --git a/src/xml-label.c b/src/xml-label.c index f7743fd5..293c0745 100644 --- a/src/xml-label.c +++ b/src/xml-label.c @@ -1842,7 +1842,6 @@ xml_create_toplevel_span (xmlNodePtr parent, PangoWeight font_weight; gboolean font_italic_flag; glColorNode *color_node; - PangoAlignment align; gdouble text_line_spacing; GList *lines, *p_line, *p_node; glTextNode *text_node; @@ -1868,7 +1867,6 @@ xml_create_toplevel_span (xmlNodePtr parent, } gl_color_node_free (&color_node); - align = gl_label_object_get_text_alignment (GL_LABEL_OBJECT(object_text)); lgl_xml_set_prop_string (node, "font_family", font_family); lgl_xml_set_prop_double (node, "font_size", font_size); lgl_xml_set_prop_string (node, "font_weight", gl_str_util_weight_to_string (font_weight));