[latexila] Build Tools: use icon-name instead of stock-id
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Build Tools: use icon-name instead of stock-id
- Date: Wed, 24 Dec 2014 20:08:27 +0000 (UTC)
commit 5fa048b50475a9f33f7ba6df1204b09909eb2f51
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Dec 24 20:41:15 2014 +0100
Build Tools: use icon-name instead of stock-id
data/build_tools/build_tools.xml | 4 ++--
src/build_tool_dialog.vala | 26 +++++++++++++-------------
src/build_tools_preferences.vala | 4 ++--
src/liblatexila/latexila-build-tools.c | 8 +++++++-
src/main_window_build_tools.vala | 3 ++-
5 files changed, 26 insertions(+), 19 deletions(-)
---
diff --git a/data/build_tools/build_tools.xml b/data/build_tools/build_tools.xml
index a173ca1..93d9bbf 100644
--- a/data/build_tools/build_tools.xml
+++ b/data/build_tools/build_tools.xml
@@ -73,13 +73,13 @@
<!-- BibTeX, MakeIndex -->
- <tool id="14" enabled="false" extensions=".tex" icon="gtk-execute">
+ <tool id="14" enabled="false" extensions=".tex" icon="system-run">
<label its:translate="no">BibTeX</label>
<description>Run BibTeX (bibliography)</description>
<job postProcessor="all-output">bibtex $shortname.aux</job>
</tool>
- <tool id="15" enabled="false" extensions=".tex" icon="gtk-execute">
+ <tool id="15" enabled="false" extensions=".tex" icon="system-run">
<label its:translate="no">MakeIndex</label>
<description>Run MakeIndex</description>
<job postProcessor="all-output">makeindex $shortname.idx</job>
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index 859dc3a..d07cf81 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -27,7 +27,7 @@ public class BuildToolDialog : GLib.Object
{
private enum IconColumn
{
- STOCK_ID,
+ ICON_NAME,
LABEL,
N_COLUMNS
}
@@ -154,27 +154,27 @@ public class BuildToolDialog : GLib.Object
private void init_icons_store ()
{
_icons_store = new ListStore (IconColumn.N_COLUMNS,
- typeof (string), // icon stock-id
+ typeof (string), // icon-name
typeof (string) // label
);
- add_icon (Stock.EXECUTE, _("Execute"));
+ add_icon ("system-run", _("Execute"));
add_icon ("compile_dvi", "LaTeX → DVI");
add_icon ("compile_pdf", "LaTeX → PDF");
add_icon ("compile_ps", "LaTeX → PS");
add_icon (Stock.CONVERT, _("Convert"));
- add_icon (Stock.FILE, _("View File"));
+ add_icon ("text-x-generic", _("View File"));
add_icon ("view_dvi", _("View DVI"));
add_icon ("view_pdf", _("View PDF"));
add_icon ("view_ps", _("View PS"));
}
- private void add_icon (string stock_id, string label)
+ private void add_icon (string icon_name, string label)
{
TreeIter iter;
_icons_store.append (out iter);
_icons_store.set (iter,
- IconColumn.STOCK_ID, stock_id,
+ IconColumn.ICON_NAME, icon_name,
IconColumn.LABEL, label
);
}
@@ -186,7 +186,7 @@ public class BuildToolDialog : GLib.Object
CellRendererPixbuf pixbuf_renderer = new CellRendererPixbuf ();
_icons_combobox.pack_start (pixbuf_renderer, false);
_icons_combobox.set_attributes (pixbuf_renderer,
- "stock-id", IconColumn.STOCK_ID);
+ "icon-name", IconColumn.ICON_NAME);
CellRendererText text_renderer = new CellRendererText ();
_icons_combobox.pack_start (text_renderer, true);
@@ -449,10 +449,10 @@ public class BuildToolDialog : GLib.Object
do
{
- string stock_id;
- model.get (iter, IconColumn.STOCK_ID, out stock_id);
+ string icon_name;
+ model.get (iter, IconColumn.ICON_NAME, out icon_name);
- if (stock_id == build_tool.icon)
+ if (icon_name == build_tool.icon)
{
_icons_combobox.set_active_iter (iter);
break;
@@ -486,9 +486,9 @@ public class BuildToolDialog : GLib.Object
TreeIter iter;
_icons_combobox.get_active_iter (out iter);
TreeModel model = _icons_store as TreeModel;
- string icon;
- model.get (iter, IconColumn.STOCK_ID, out icon);
- tool.icon = icon;
+ string icon_name;
+ model.get (iter, IconColumn.ICON_NAME, out icon_name);
+ tool.icon = icon_name;
/* Jobs */
diff --git a/src/build_tools_preferences.vala b/src/build_tools_preferences.vala
index 5e90867..e252f1c 100644
--- a/src/build_tools_preferences.vala
+++ b/src/build_tools_preferences.vala
@@ -160,7 +160,7 @@ public class BuildToolsPreferences : GLib.Object
{
return new ListStore (BuildToolColumn.N_COLUMNS,
typeof (bool), // enabled
- typeof (string), // pixbuf (stock-id)
+ typeof (string), // pixbuf (icon-name)
typeof (string), // label
typeof (string) // description
);
@@ -187,7 +187,7 @@ public class BuildToolsPreferences : GLib.Object
CellRendererPixbuf pixbuf_renderer = new CellRendererPixbuf ();
label_column.pack_start (pixbuf_renderer, false);
label_column.set_attributes (pixbuf_renderer,
- "stock-id", BuildToolColumn.PIXBUF);
+ "icon-name", BuildToolColumn.PIXBUF);
CellRendererText text_renderer = new CellRendererText ();
label_column.pack_start (text_renderer, true);
diff --git a/src/liblatexila/latexila-build-tools.c b/src/liblatexila/latexila-build-tools.c
index d61963b..be2c591 100644
--- a/src/liblatexila/latexila-build-tools.c
+++ b/src/liblatexila/latexila-build-tools.c
@@ -170,7 +170,13 @@ parser_start_element (GMarkupParseContext *context,
}
else if (g_str_equal (attribute_names[i], "icon"))
{
- g_object_set (cur_tool, "icon", attribute_values[i], NULL);
+ /* Migrate from GtkStock to icon-names. */
+ if (g_str_equal (attribute_values[i], "gtk-execute"))
+ g_object_set (cur_tool, "icon", "system-run", NULL);
+ else if (g_str_equal (attribute_values[i], "gtk-file"))
+ g_object_set (cur_tool, "icon", "text-x-generic", NULL);
+ else
+ g_object_set (cur_tool, "icon", attribute_values[i], NULL);
}
else if (error != NULL)
{
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index a615168..2da298f 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -312,7 +312,8 @@ public class MainWindowBuildTools
return;
Gtk.Action action = new Gtk.Action (action_name, build_tool.label,
- build_tool.get_description (), build_tool.icon);
+ build_tool.get_description (), null);
+ action.icon_name = build_tool.icon;
// F2 -> F11
// (F1 = help, F12 = show/hide side panel)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]