[vinagre] Rework Vinagre.Dirs.get_ui_file() logic
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vinagre] Rework Vinagre.Dirs.get_ui_file() logic
- Date: Thu, 30 Jun 2011 13:18:53 +0000 (UTC)
commit cd772a2283e2ea45ecbb4249a779c0f6ea6d5150
Author: David King <amigadave amigadave com>
Date: Thu Jun 30 15:13:55 2011 +0200
Rework Vinagre.Dirs.get_ui_file() logic
Rename Vinagre.Dirs.get_ui_file() to
Vinagre.Dirs.get_package_data_file(). Change logic of
Vinagre.Dirs.get_vinagre_data_dir() to use the package data directory
instaed of a versioned subdirectory. Use get_package_data_file() in
vinagre-utils.vala and vinagre-window.c, removng internal
_get_ui_xml_filename() in vinagre-window.c.
vinagre/vinagre-dirs.vala | 11 ++++-------
vinagre/vinagre-utils.vala | 3 +--
vinagre/vinagre-window.c | 16 +++++-----------
3 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/vinagre/vinagre-dirs.vala b/vinagre/vinagre-dirs.vala
index d8afd97..f9bf03d 100644
--- a/vinagre/vinagre-dirs.vala
+++ b/vinagre/vinagre-dirs.vala
@@ -27,22 +27,19 @@ namespace Vinagre.Dirs {
Config.PACKAGE_TARNAME);
}
- // Only used by get_ui_file ().
+ // Only used by get_package_data_file ().
private string get_vinagre_data_dir () {
#if ! G_OS_WIN32
// TODO: const string[] data_dirs = Environment.get_system_data_dirs ();
- return Path.build_filename (Config.DATADIR,
- "%s-%s".printf (Config.PACKAGE_TARNAME,
- Config.VINAGRE_ABI_VERSION));
+ return Path.build_filename (Config.DATADIR, Config.PACKAGE_TARNAME);
#else
return Path.build_filename (
Win32.get_package_installation_directory_of_module (null), "share",
- "%s-%s".printf (Config.PACKAGE_TARNAME,
- Config.VINAGRE_ABI_VERSION));
+ Config.PACKAGE_TARNAME);
#endif
}
- public string get_ui_file (string filename) {
+ public string get_package_data_file (string filename) {
return Path.build_filename (get_vinagre_data_dir (), filename);
}
}
diff --git a/vinagre/vinagre-utils.vala b/vinagre/vinagre-utils.vala
index 037d62c..16f4e19 100644
--- a/vinagre/vinagre-utils.vala
+++ b/vinagre/vinagre-utils.vala
@@ -74,8 +74,7 @@ namespace Vinagre.Utils {
}
public Builder get_builder () {
- var filename = Path.build_filename (Vinagre.Config.VINAGRE_DATADIR,
- "vinagre.ui");
+ var filename = Vinagre.Dirs.get_package_data_file ("vinagre.ui");
var builder = new Builder ();
try {
diff --git a/vinagre/vinagre-window.c b/vinagre/vinagre-window.c
index c5c504e..26df706 100644
--- a/vinagre/vinagre-window.c
+++ b/vinagre/vinagre-window.c
@@ -52,16 +52,6 @@
G_DEFINE_TYPE(VinagreWindow, vinagre_window, GTK_TYPE_WINDOW)
-static const gchar * _get_ui_xml_filename (void)
-{
- static const gchar ui_xml_file[] = "vinagre-ui.xml";
-
- if (g_file_test (ui_xml_file, G_FILE_TEST_EXISTS))
- return ui_xml_file;
- else
- return g_build_filename (VINAGRE_DATADIR, ui_xml_file, NULL);
-}
-
static void
vinagre_window_dispose (GObject *object)
{
@@ -323,6 +313,7 @@ create_menu_bar_and_toolbar (VinagreWindow *window,
GtkRecentManager *recent_manager;
GtkRecentFilter *filter;
GtkAction *action;
+ gchar *filename;
manager = gtk_ui_manager_new ();
window->priv->manager = manager;
@@ -385,7 +376,10 @@ create_menu_bar_and_toolbar (VinagreWindow *window,
window->priv->remote_initialized_action_group = action_group;
/* now load the UI definition */
- gtk_ui_manager_add_ui_from_file (manager, _get_ui_xml_filename (), &error);
+ filename = vinagre_dirs_get_package_data_file ("vinagre-ui.xml");
+ gtk_ui_manager_add_ui_from_file (manager, filename, &error);
+ g_free (filename);
+
if (error != NULL)
{
g_critical (_("Could not merge UI XML file: %s"), error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]