[glade] GladeLabelEditor: Removed old UI construction code
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladeLabelEditor: Removed old UI construction code
- Date: Sun, 21 Apr 2013 12:39:05 +0000 (UTC)
commit f39d7233a8c86c34862b9db1970eb89a779fb8f5
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Apr 21 21:35:04 2013 +0900
GladeLabelEditor: Removed old UI construction code
plugins/gtk+/glade-label-editor.c | 294 --------------------------------------
1 file changed, 294 deletions(-)
---
diff --git a/plugins/gtk+/glade-label-editor.c b/plugins/gtk+/glade-label-editor.c
index b4571ff..97eb7c4 100644
--- a/plugins/gtk+/glade-label-editor.c
+++ b/plugins/gtk+/glade-label-editor.c
@@ -502,302 +502,8 @@ wrap_mode_toggled (GtkWidget * widget, GladeLabelEditor * label_editor)
glade_editable_load (GLADE_EDITABLE (label_editor), gwidget);
}
-#if 0
-static void
-table_attach (GtkWidget * table, GtkWidget * child, gint pos, gint row)
-{
- gtk_grid_attach (GTK_GRID (table), child, pos, row, 1, 1);
-
- if (pos)
- gtk_widget_set_hexpand (child, TRUE);
-}
-
-static void
-append_label_appearance (GladeLabelEditor * label_editor,
- GladeWidgetAdaptor * adaptor)
-{
- GladeEditorProperty *eprop, *markup_property;
- GtkWidget *table, *frame, *alignment, *label, *hbox;
- gchar *str;
-
- /* Label appearance... */
- str = g_strdup_printf ("<b>%s</b>", _("Edit label appearance"));
- label = gtk_label_new (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- g_free (str);
- frame = gtk_frame_new (NULL);
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 8);
-
- 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);
-
- table = gtk_grid_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
- GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (table), 4);
- gtk_container_add (GTK_CONTAINER (alignment), table);
-
- /* Edit the label itself... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "label", FALSE, TRUE);
- table_attach (table, glade_editor_property_get_item_label (eprop), 0, 0);
- table_attach (table, GTK_WIDGET (eprop), 1, 0);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* Edit by attributes... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "glade-attributes",
- FALSE, TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->attributes_radio = gtk_radio_button_new (NULL);
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->attributes_radio, FALSE,
- FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
- table_attach (table, hbox, 0, 1);
- table_attach (table, GTK_WIDGET (eprop), 1, 1);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* Edit with label as pango markup strings... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "use-markup", FALSE,
- TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->markup_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (label_editor->attributes_radio));
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->markup_radio, FALSE, FALSE,
- 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
- table_attach (table, hbox, 0, 2);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
- markup_property = eprop; /* Its getting into a hidden row on the bottom... */
-
- /* Add underscores from pattern string... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "pattern", FALSE,
- TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->pattern_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (label_editor->attributes_radio));
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->pattern_radio, FALSE, FALSE,
- 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
- table_attach (table, hbox, 0, 3);
- table_attach (table, GTK_WIDGET (eprop), 1, 3);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* Tie the invisible editor property to the table's life-cycle */
- g_object_set_data_full (G_OBJECT (table), "glade-markup-property-destroy-me",
- markup_property, (GDestroyNotify) gtk_widget_destroy);
-}
-
-
-static void
-append_label_formatting (GladeLabelEditor * label_editor,
- GladeWidgetAdaptor * adaptor)
-{
- GladeEditorProperty *eprop;
- GtkWidget *table, *frame, *alignment, *label, *hbox;
- gchar *str;
- gint row = 0;
-
- /* Label formatting... */
- str = g_strdup_printf ("<b>%s</b>", _("Format label"));
- label = gtk_label_new (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- g_free (str);
- frame = gtk_frame_new (NULL);
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 0);
-
- 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);
-
- table = gtk_grid_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
- GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (table), 4);
- gtk_container_add (GTK_CONTAINER (alignment), table);
-
- /* ellipsize... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "ellipsize", FALSE,
- TRUE);
- table_attach (table, glade_editor_property_get_item_label (eprop), 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* justify... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "justify", FALSE,
- TRUE);
- table_attach (table, glade_editor_property_get_item_label (eprop), 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* angle... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "angle", FALSE, TRUE);
- table_attach (table, glade_editor_property_get_item_label (eprop), 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* width-chars ... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "width-chars", FALSE,
- TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->width_radio = gtk_radio_button_new (NULL);
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->width_radio, FALSE, FALSE,
- 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
- table_attach (table, hbox, 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* max-width-chars ... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "max-width-chars",
- FALSE, TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->max_width_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (label_editor->width_radio));
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->max_width_radio, FALSE,
- FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop), TRUE, TRUE, 2);
- table_attach (table, hbox, 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-}
-
-static void
-append_label_wrapping (GladeLabelEditor * label_editor,
- GladeWidgetAdaptor * adaptor)
-{
- GladeEditorProperty *eprop, *single_line_eprop;
- GtkWidget *table, *frame, *alignment, *label, *hbox;
- gchar *str;
- gint row = 0;
-
- /* Line Wrapping... */
- str = g_strdup_printf ("<b>%s</b>", _("Text line wrapping"));
- label = gtk_label_new (str);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- g_free (str);
- frame = gtk_frame_new (NULL);
- gtk_frame_set_label_widget (GTK_FRAME (frame), label);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
- gtk_box_pack_start (GTK_BOX (label_editor), frame, FALSE, FALSE, 0);
-
- 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);
-
- table = gtk_grid_new ();
- gtk_orientable_set_orientation (GTK_ORIENTABLE (table),
- GTK_ORIENTATION_VERTICAL);
- gtk_grid_set_row_spacing (GTK_GRID (table), 4);
- gtk_container_add (GTK_CONTAINER (alignment), table);
-
- /* Append defaut epropless radio... */
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->wrap_free_radio = gtk_radio_button_new (NULL);
- label_editor->wrap_free_label = gtk_label_new (_("Text wraps normally"));
- gtk_misc_set_alignment (GTK_MISC (label_editor->wrap_free_label), 0.0F, 0.5F);
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_free_radio, FALSE,
- FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_free_label, TRUE, TRUE,
- 2);
- table_attach (table, hbox, 0, row++);
-
- /* single-line-mode ... */
- single_line_eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "single-line-mode",
- FALSE, TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->single_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->single_radio, FALSE, FALSE,
- 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (single_line_eprop),
- TRUE, TRUE, 2);
- table_attach (table, hbox, 0, row++);
- label_editor->properties =
- g_list_prepend (label_editor->properties, single_line_eprop);
-
- /* wrap-mode ... */
- eprop =
- glade_widget_adaptor_create_eprop_by_name (adaptor, "wrap-mode", FALSE,
- TRUE);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- label_editor->wrap_mode_radio = gtk_radio_button_new_from_widget
- (GTK_RADIO_BUTTON (label_editor->wrap_free_radio));
- gtk_box_pack_start (GTK_BOX (hbox), label_editor->wrap_mode_radio, FALSE,
- FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), glade_editor_property_get_item_label (eprop),
- TRUE, TRUE, 2);
- table_attach (table, hbox, 0, row);
- table_attach (table, GTK_WIDGET (eprop), 1, row++);
- label_editor->properties = g_list_prepend (label_editor->properties, eprop);
-
- /* Tie the invisible editor property to the table's life-cycle */
- g_object_set_data_full (G_OBJECT (table),
- "glade-single-line-property-destroy-me",
- single_line_eprop,
- (GDestroyNotify) gtk_widget_destroy);
-}
-#endif
-
-
GtkWidget *
glade_label_editor_new (void)
{
return g_object_new (GLADE_TYPE_LABEL_EDITOR, NULL);
-
-#if 0
- GladeLabelEditor *label_editor;
-
- g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
- g_return_val_if_fail (GLADE_IS_EDITABLE (embed), NULL);
-
- label_editor = g_object_new (GLADE_TYPE_LABEL_EDITOR, NULL);
- label_editor->embed = GTK_WIDGET (embed);
-
- /* Pack the parent on top... */
- gtk_box_pack_start (GTK_BOX (label_editor), GTK_WIDGET (embed), FALSE, FALSE,
- 0);
-
- append_label_appearance (label_editor, adaptor);
- append_label_formatting (label_editor, adaptor);
- append_label_wrapping (label_editor, adaptor);
-
- /* Connect to our radio buttons.... */
- g_signal_connect (G_OBJECT (label_editor->attributes_radio), "toggled",
- G_CALLBACK (attributes_toggled), label_editor);
- g_signal_connect (G_OBJECT (label_editor->markup_radio), "toggled",
- G_CALLBACK (markup_toggled), label_editor);
- g_signal_connect (G_OBJECT (label_editor->pattern_radio), "toggled",
- G_CALLBACK (pattern_toggled), label_editor);
-
- g_signal_connect (G_OBJECT (label_editor->width_radio), "toggled",
- G_CALLBACK (width_toggled), label_editor);
- g_signal_connect (G_OBJECT (label_editor->max_width_radio), "toggled",
- G_CALLBACK (max_width_toggled), label_editor);
-
- g_signal_connect (G_OBJECT (label_editor->wrap_free_radio), "toggled",
- G_CALLBACK (wrap_free_toggled), label_editor);
- g_signal_connect (G_OBJECT (label_editor->single_radio), "toggled",
- G_CALLBACK (single_toggled), label_editor);
- g_signal_connect (G_OBJECT (label_editor->wrap_mode_radio), "toggled",
- G_CALLBACK (wrap_mode_toggled), label_editor);
-
-
- gtk_widget_show_all (GTK_WIDGET (label_editor));
-
- return GTK_WIDGET (label_editor);
-#endif
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]