[glom] Replace use of (deprecated) GtkLabel alignment.



commit d8730c4174ac3a27e8aac4ed13a6855445c4fbd6
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jun 5 22:03:25 2014 +0200

    Replace use of (deprecated) GtkLabel alignment.

 glom/mode_data/datawidget/combo.cc                 |    2 +-
 .../mode_data/datawidget/combo_as_radio_buttons.cc |    2 +-
 glom/mode_data/datawidget/datawidget.cc            |    6 +++---
 glom/mode_data/datawidget/entry.cc                 |    4 ++--
 glom/mode_data/datawidget/label.cc                 |    2 +-
 glom/mode_data/datawidget/label.h                  |    2 +-
 glom/mode_data/flowtablewithfields.cc              |    2 +-
 .../filechooserdialog_saveextras.cc                |    6 ++++--
 glom/utility_widgets/layoutwidgetbase.cc           |    6 ++----
 9 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/glom/mode_data/datawidget/combo.cc b/glom/mode_data/datawidget/combo.cc
index 1423f1c..503c559 100644
--- a/glom/mode_data/datawidget/combo.cc
+++ b/glom/mode_data/datawidget/combo.cc
@@ -52,7 +52,7 @@ ComboGlom::ComboGlom(bool has_entry)
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   //if(m_glom_type == Field::TYPE_NUMERIC)
-   // get_entry()->set_alignment(1.0); //Align numbers to the right.
+   // get_entry()->set_halign(Gtk::ALIGN_END); //Align numbers to the right.
 
   //Let the combo be big enough:
   set_popup_fixed_width(false);
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc 
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index 93752d3..c1befc4 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -49,7 +49,7 @@ ComboAsRadioButtons::ComboAsRadioButtons()
 void ComboAsRadioButtons::init()
 {
   //if(m_glom_type == Field::TYPE_NUMERIC)
-   // get_entry()->set_alignment(1.0); //Align numbers to the right.
+   // get_entry()->set_halign(Gtk::ALIGN_END); //Align numbers to the right.
 }
 
 void ComboAsRadioButtons::set_choices_with_second(const type_list_values_with_second& list_values)
diff --git a/glom/mode_data/datawidget/datawidget.cc b/glom/mode_data/datawidget/datawidget.cc
index 9c11bb4..da37428 100644
--- a/glom/mode_data/datawidget/datawidget.cc
+++ b/glom/mode_data/datawidget/datawidget.cc
@@ -86,7 +86,7 @@ DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ust
     pFieldWidget = checkbutton;
 
     m_label.set_label(title);
-    m_label.set_alignment(0);
+    m_label.set_halign(Gtk::ALIGN_START);
     m_label.show();
   }
   else if(glom_type == Field::TYPE_IMAGE)
@@ -103,13 +103,13 @@ DataWidget::DataWidget(const sharedptr<LayoutItem_Field>& field, const Glib::ust
     pFieldWidget = image;
 
     m_label.set_label(title);
-    m_label.set_alignment(0);
+    m_label.set_halign(Gtk::ALIGN_START);
     m_label.show();
   }
   else
   {
     m_label.set_label(title);
-    m_label.set_alignment(0);
+    m_label.set_halign(Gtk::ALIGN_START);
     m_label.show();
 
     //Use a Combo if there is a drop-down of choices (A "value list"), else an Entry:
diff --git a/glom/mode_data/datawidget/entry.cc b/glom/mode_data/datawidget/entry.cc
index 0f2505f..de9c24e 100644
--- a/glom/mode_data/datawidget/entry.cc
+++ b/glom/mode_data/datawidget/entry.cc
@@ -77,8 +77,8 @@ void Entry::set_layout_item(const sharedptr<LayoutItem>& layout_item, const Glib
   if(layout_field)
     alignment = layout_field->get_formatting_used_horizontal_alignment(true /* for details view */);
 
-  const float x_align = (alignment == Formatting::HORIZONTAL_ALIGNMENT_LEFT ? 0.0 : 1.0);
-  set_alignment(x_align);
+  const Gtk::Align x_align = (alignment == Formatting::HORIZONTAL_ALIGNMENT_LEFT ? Gtk::ALIGN_START : 
Gtk::ALIGN_END);
+  set_halign(x_align);
 }
 
 void Entry::set_glom_type(Field::glom_field_type glom_type)
diff --git a/glom/mode_data/datawidget/label.cc b/glom/mode_data/datawidget/label.cc
index ad6b96c..9c59b47 100644
--- a/glom/mode_data/datawidget/label.cc
+++ b/glom/mode_data/datawidget/label.cc
@@ -44,7 +44,7 @@ Label::Label(const Glib::ustring& label, bool mnemonic)
   init();
 }
 
-Label::Label(const Glib::ustring& label, float xalign, float yalign, bool mnemonic)
+Label::Label(const Glib::ustring& label, Gtk::Align xalign, Gtk::Align yalign, bool mnemonic)
 : m_label(label, xalign, yalign, mnemonic)
 {
   init();
diff --git a/glom/mode_data/datawidget/label.h b/glom/mode_data/datawidget/label.h
index cbf2c71..c90f53e 100644
--- a/glom/mode_data/datawidget/label.h
+++ b/glom/mode_data/datawidget/label.h
@@ -43,7 +43,7 @@ class Label
 public:
   Label();
   explicit Label(const Glib::ustring& label, bool mnemonic = false);
-  explicit Label(const Glib::ustring& label, float xalign, float yalign, bool mnemonic = false);
+  explicit Label(const Glib::ustring& label, Gtk::Align xalign, Gtk::Align yalign, bool mnemonic = false);
   virtual ~Label();
   
   Gtk::Label* get_label();
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 3322810..6a0c0bb 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -575,7 +575,7 @@ void FlowTableWithFields::add_textobject(const sharedptr<LayoutItem_Text>& layou
   }
   else
   {
-    DataWidgetChildren::Label* title_label = Gtk::manage(new DataWidgetChildren::Label(title, 0, 0, false));
+    DataWidgetChildren::Label* title_label = Gtk::manage(new DataWidgetChildren::Label(title, 
Gtk::ALIGN_START, Gtk::ALIGN_START, false));
     title_label->set_layout_item(layoutitem_text, table_name);
     title_label->set_halign(Gtk::ALIGN_END);
     title_label->set_valign(Gtk::ALIGN_CENTER);
diff --git a/glom/utility_widgets/filechooserdialog_saveextras.cc 
b/glom/utility_widgets/filechooserdialog_saveextras.cc
index 82bbaaa..f9adcc4 100644
--- a/glom/utility_widgets/filechooserdialog_saveextras.cc
+++ b/glom/utility_widgets/filechooserdialog_saveextras.cc
@@ -75,7 +75,8 @@ void FileChooserDialog_SaveExtras::set_extra_message(const Glib::ustring& messag
 void FileChooserDialog_SaveExtras::create_child_widgets()
 {
   //m_extra_widget.pack_start(m_label_extra_message);
-  m_label_extra_message.set_alignment(0.0f, 0.5f);
+  m_label_extra_message.set_halign(Gtk::ALIGN_START);
+  m_label_extra_message.set_valign(Gtk::ALIGN_CENTER);
 
   Gtk::Frame* frame = Gtk::manage(new Gtk::Frame());
   Gtk::Label* frame_label = Gtk::manage(new Gtk::Label());
@@ -95,7 +96,8 @@ void FileChooserDialog_SaveExtras::create_child_widgets()
 
   Gtk::Label* label_newdb = Gtk::manage(new Gtk::Label(_("Please choose a human-readable title for the new 
database. You can change this later in the database properties. It may contain any characters.")));
   vbox->pack_start(*label_newdb);
-  label_newdb->set_alignment(0.0f, 0.5f);
+  label_newdb->set_halign(Gtk::ALIGN_START);
+  label_newdb->set_valign(Gtk::ALIGN_CENTER);
   label_newdb->show();
 
   Gtk::Box* box_label = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 
UiUtils::DEFAULT_SPACING_LARGE));
diff --git a/glom/utility_widgets/layoutwidgetbase.cc b/glom/utility_widgets/layoutwidgetbase.cc
index bb8a9a1..950ed1d 100644
--- a/glom/utility_widgets/layoutwidgetbase.cc
+++ b/glom/utility_widgets/layoutwidgetbase.cc
@@ -116,10 +116,8 @@ void LayoutWidgetBase::apply_formatting(Gtk::Widget& widget, const sharedptr<con
   //Horizontal alignment:
   const Formatting::HorizontalAlignment alignment =
     layout_item->get_formatting_used_horizontal_alignment(true /* for details view */);
-  const float x_align = (alignment == Formatting::HORIZONTAL_ALIGNMENT_LEFT ? 0.0 : 1.0);
-  Gtk::Misc* misc = dynamic_cast<Gtk::Misc*>(widget_to_change);
-  if(misc)
-    misc->set_alignment(x_align);
+  const Gtk::Align x_align = (alignment == Formatting::HORIZONTAL_ALIGNMENT_LEFT ? Gtk::ALIGN_START : 
Gtk::ALIGN_END);
+  widget_to_change->set_halign(x_align);
     
   //Set justification on labels:
   //Assume that people want left/right justification of multi-line text if they chose 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]