[latexila/wip/templates-revamp: 4/10] Use latexila_utils_get_dialog_component()



commit 856fbf0278262fdfbcc15d73f98fdb666b312065
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Apr 15 17:07:21 2015 +0200

    Use latexila_utils_get_dialog_component()

 src/build_tool_dialog.vala       |   20 ++++++++++----------
 src/build_tools_preferences.vala |    8 ++++----
 src/project_dialogs.vala         |    8 ++++----
 src/templates_dialogs.vala       |    6 +++---
 src/utils.vala                   |   20 --------------------
 5 files changed, 21 insertions(+), 41 deletions(-)
---
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index bcfd28a..6a22e14 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -588,28 +588,28 @@ public class BuildToolDialog : GLib.Object
         return grid;
     }
 
-    private Grid get_desc_grid ()
+    private Widget get_desc_grid ()
     {
         _entry_desc.hexpand = true;
-        return Utils.get_dialog_component (_("Description"), _entry_desc);
+        return Latexila.utils_get_dialog_component (_("Description"), _entry_desc);
     }
 
-    private Grid get_extensions_grid ()
+    private Widget get_extensions_grid ()
     {
         _entry_extensions.set_tooltip_text (
             _("File extensions for which the build tool can be executed.") + "\n" +
             _("The extensions are separated by spaces.") + "\n" +
             _("If it is empty, all extensions are allowed."));
 
-        return Utils.get_dialog_component (_("Extensions"), _entry_extensions);
+        return Latexila.utils_get_dialog_component (_("Extensions"), _entry_extensions);
     }
 
-    private Grid get_icons_grid ()
+    private Widget get_icons_grid ()
     {
-        return Utils.get_dialog_component (_("Icon"), _icons_combobox);
+        return Latexila.utils_get_dialog_component (_("Icon"), _icons_combobox);
     }
 
-    private Grid get_jobs_grid (bool editable)
+    private Widget get_jobs_grid (bool editable)
     {
         /* Placeholders */
 
@@ -672,10 +672,10 @@ public class BuildToolDialog : GLib.Object
             context.set_junction_sides (JunctionSides.TOP);
         }
 
-        return Utils.get_dialog_component (_("Jobs"), jobs_box);
+        return Latexila.utils_get_dialog_component (_("Jobs"), jobs_box);
     }
 
-    private Grid get_files_to_open_grid ()
+    private Widget get_files_to_open_grid ()
     {
         _entry_files_to_open.set_tooltip_text (
             _("List of files to open after executing the build jobs.") + "\n" +
@@ -683,6 +683,6 @@ public class BuildToolDialog : GLib.Object
             _("You should use the placeholders to specify the files."));
 
         _entry_files_to_open.hexpand = true;
-        return Utils.get_dialog_component (_("Files to open"), _entry_files_to_open);
+        return Latexila.utils_get_dialog_component (_("Files to open"), _entry_files_to_open);
     }
 }
diff --git a/src/build_tools_preferences.vala b/src/build_tools_preferences.vala
index 2df61bf..65f5cc2 100644
--- a/src/build_tools_preferences.vala
+++ b/src/build_tools_preferences.vala
@@ -96,7 +96,7 @@ public class BuildToolsPreferences : GLib.Object
         });
     }
 
-    private Grid get_default_grid ()
+    private Widget get_default_grid ()
     {
         Latexila.BuildTools default_build_tools =
             Latexila.BuildToolsDefault.get_instance () as Latexila.BuildTools;
@@ -110,10 +110,10 @@ public class BuildToolsPreferences : GLib.Object
 
         Widget join = join_view_and_toolbar (_default_view, toolbar);
 
-        return Utils.get_dialog_component (_("Default Build Tools"), join);
+        return Latexila.utils_get_dialog_component (_("Default Build Tools"), join);
     }
 
-    private Grid get_personal_grid ()
+    private Widget get_personal_grid ()
     {
         Latexila.BuildTools personal_build_tools =
             Latexila.BuildToolsPersonal.get_instance () as Latexila.BuildTools;
@@ -131,7 +131,7 @@ public class BuildToolsPreferences : GLib.Object
 
         Widget join = join_view_and_toolbar (_personal_view, toolbar);
 
-        return Utils.get_dialog_component (_("Personal Build Tools"), join);
+        return Latexila.utils_get_dialog_component (_("Personal Build Tools"), join);
     }
 
     private Widget join_view_and_toolbar (TreeView view, Toolbar toolbar)
diff --git a/src/project_dialogs.vala b/src/project_dialogs.vala
index 442d192..5f0700e 100644
--- a/src/project_dialogs.vala
+++ b/src/project_dialogs.vala
@@ -40,14 +40,14 @@ namespace ProjectDialogs
             FileChooserAction.SELECT_FOLDER);
         directory_chooser.set_size_request (250, -1);
         directory_chooser.hexpand = true;
-        Widget component = Utils.get_dialog_component (_("Directory"), directory_chooser);
+        Widget component = Latexila.utils_get_dialog_component (_("Directory"), directory_chooser);
         content_area.pack_start (component, false);
 
         // main file
         FileChooserButton main_file_chooser = new FileChooserButton (_("Main File"),
             FileChooserAction.OPEN);
         main_file_chooser.hexpand = true;
-        component = Utils.get_dialog_component (_("Main File"), main_file_chooser);
+        component = Latexila.utils_get_dialog_component (_("Main File"), main_file_chooser);
         content_area.pack_start (component, false);
 
         content_area.show_all ();
@@ -136,7 +136,7 @@ namespace ProjectDialogs
         location.set_halign (Align.START);
         location.hexpand = true;
 
-        Widget component = Utils.get_dialog_component (_("Location of the project"),
+        Widget component = Latexila.utils_get_dialog_component (_("Location of the project"),
             location);
         content_area.pack_start (component, false);
 
@@ -144,7 +144,7 @@ namespace ProjectDialogs
         FileChooserButton main_file_chooser = new FileChooserButton (_("Main File"),
             FileChooserAction.OPEN);
         main_file_chooser.hexpand = true;
-        component = Utils.get_dialog_component (_("Main File"), main_file_chooser);
+        component = Latexila.utils_get_dialog_component (_("Main File"), main_file_chooser);
         content_area.pack_start (component, false);
 
         content_area.show_all ();
diff --git a/src/templates_dialogs.vala b/src/templates_dialogs.vala
index d176e93..766ef07 100644
--- a/src/templates_dialogs.vala
+++ b/src/templates_dialogs.vala
@@ -39,7 +39,7 @@ public class CreateTemplateDialog : Dialog
         /* name */
         Entry entry = new Entry ();
         entry.hexpand = true;
-        Widget component = Utils.get_dialog_component (_("Name of the new template"),
+        Widget component = Latexila.utils_get_dialog_component (_("Name of the new template"),
             entry);
         content_area.pack_start (component, false);
 
@@ -52,7 +52,7 @@ public class CreateTemplateDialog : Dialog
         ScrolledWindow scrollbar = Utils.add_scrollbar (templates_list);
         scrollbar.set_shadow_type (ShadowType.IN);
         scrollbar.set_size_request (250, 200);
-        component = Utils.get_dialog_component (_("Choose an icon"), scrollbar);
+        component = Latexila.utils_get_dialog_component (_("Choose an icon"), scrollbar);
         content_area.pack_start (component);
 
         content_area.show_all ();
@@ -113,7 +113,7 @@ public class DeleteTemplateDialog : Dialog
         ScrolledWindow scrollbar = Utils.add_scrollbar (templates_list);
         scrollbar.set_shadow_type (ShadowType.IN);
         scrollbar.set_size_request (250, 150);
-        Widget component = Utils.get_dialog_component (_("Personal Templates"),
+        Widget component = Latexila.utils_get_dialog_component (_("Personal Templates"),
             scrollbar);
 
         Box content_area = get_content_area () as Box;
diff --git a/src/utils.vala b/src/utils.vala
index 79b67a7..d26ad9a 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -283,26 +283,6 @@ namespace Utils
         return -1;
     }
 
-    public Grid get_dialog_component (string title, Widget widget)
-    {
-        Grid grid = new Grid ();
-        grid.orientation = Orientation.VERTICAL;
-        grid.set_row_spacing (6);
-        grid.border_width = 6;
-
-        // title in bold, left aligned
-        Label label = new Label (null);
-        label.set_markup ("<b>" + title + "</b>");
-        label.set_halign (Align.START);
-        grid.add (label);
-
-        // left margin for the widget
-        widget.set_margin_start (12);
-        grid.add (widget);
-
-        return grid;
-    }
-
     public unowned Gtk.Window? get_toplevel_window (Widget widget)
     {
         unowned Widget toplevel = widget.get_toplevel ();


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