[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-gtk] branch master updated: -make gnunet-gtk respect NLS setting
From: |
gnunet |
Subject: |
[gnunet-gtk] branch master updated: -make gnunet-gtk respect NLS settings from GNUNET_OS-project data |
Date: |
Mon, 12 Jul 2021 09:39:10 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 45a8958d -make gnunet-gtk respect NLS settings from GNUNET_OS-project
data
45a8958d is described below
commit 45a8958dcf27d499773a33da4fcf15edbe643897
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jul 12 09:35:55 2021 +0200
-make gnunet-gtk respect NLS settings from GNUNET_OS-project data
---
gnunet-setup.desktop.in | 2 +-
src/include/gnunet_gtk.h | 12 ++++++++----
src/lib/about.c | 9 ++++++---
src/lib/nls.c | 48 +++++++++++++++++++++++------------------------
src/lib/os_installation.c | 26 ++++++++++++++-----------
src/lib/trayicon.c | 20 ++++++++++++++------
6 files changed, 67 insertions(+), 50 deletions(-)
diff --git a/gnunet-setup.desktop.in b/gnunet-setup.desktop.in
index 7c90d3c8..bb987a70 100644
--- a/gnunet-setup.desktop.in
+++ b/gnunet-setup.desktop.in
@@ -5,7 +5,7 @@ GenericName=GNUnet Setup
Comment=Configure GNUnet
Type=Application
-Exec=gnunet-setup-pkexec
+Exec=gnunet-setup
Icon=gnunet-setup
Terminal=false
Categories=GTK;Network;P2P;FileTransfer;
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h
index 5ec8901e..b7370390 100644
--- a/src/include/gnunet_gtk.h
+++ b/src/include/gnunet_gtk.h
@@ -62,7 +62,8 @@ struct GNUNET_GTK_MainLoop;
* @return new main window to initialize
*/
GtkWidget *
-GNUNET_GTK_plug_me (const char *env_name, GtkWidget *main_window);
+GNUNET_GTK_plug_me (const char *env_name,
+ GtkWidget *main_window);
/**
@@ -91,7 +92,8 @@ GNUNET_GTK_get_data_dir (void);
/**
* @brief get the path to a specific GNUnet installation directory or,
- * with #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
directory
+ * with #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
+ * directory
* @author Milan
*
* @param dirkind which directory should be returned
@@ -202,8 +204,10 @@ GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
GtkTreeIter *root);
* @param argv command line options
* @param options allowed command line options
* @param main_window_file glade file for the main window
- * @param main_task first task to run, closure will be set to the `struct
GNUNET_GTK_MainLoop`
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. bad
command-line options, etc)
+ * @param main_task first task to run, closure will be set to the `struct
+ * GNUNET_GTK_MainLoop`
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. bad
command-line
+ * options, etc)
*/
int
GNUNET_GTK_main_loop_start (const char *binary_name,
diff --git a/src/lib/about.c b/src/lib/about.c
index 8181bc4b..b8def8d0 100644
--- a/src/lib/about.c
+++ b/src/lib/about.c
@@ -212,12 +212,15 @@ GNUNET_GTK_display_about (const char *dialogfile)
return;
}
ctx->about_credits_notebook = GTK_WIDGET (
- gtk_builder_get_object (ctx->builder, "about_credits_notebook"));
+ gtk_builder_get_object (ctx->builder,
+ "about_credits_notebook"));
ctx->about_license_scroller = GTK_WIDGET (
gtk_builder_get_object (ctx->builder, "about_license_scroller"));
- ctx->ad = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "about_window"));
+ ctx->ad = GTK_WIDGET (gtk_builder_get_object (ctx->builder,
+ "about_window"));
ctx->license_contents =
- GTK_TEXT_BUFFER (gtk_builder_get_object (ctx->builder,
"license_contents"));
+ GTK_TEXT_BUFFER (gtk_builder_get_object (ctx->builder,
+ "license_contents"));
gtk_widget_show (ctx->ad);
}
diff --git a/src/lib/nls.c b/src/lib/nls.c
index cc6f0e5f..ca57ce32 100644
--- a/src/lib/nls.c
+++ b/src/lib/nls.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2010, 2011 GNUnet e.V.
+ Copyright (C) 2010, 2011, 2021 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -17,7 +17,6 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-
/**
* @file src/lib/nls.c
* @brief natural language support
@@ -30,24 +29,32 @@
#endif
-/**
- * Initialize GNU gettext for message translation.
- */
void
GNUNET_GTK_setup_nls ()
{
#if ENABLE_NLS
+ struct GNUNET_OS_ProjectData *mypd;
+ struct GNUNET_OS_ProjectData *pd;
char *path;
+ pd = GNUNET_OS_project_data_get ();
setlocale (LC_ALL, "");
GNUNET_asprintf (&path,
"%s/%s/locale/",
GNUNET_GTK_get_data_dir (),
PACKAGE_NAME);
- bindtextdomain ("gnunet-gtk", path);
- textdomain ("gnunet-gtk");
- bind_textdomain_codeset ("GNUnet", "UTF-8");
- bind_textdomain_codeset ("gnunet-gtk", "UTF-8");
+ bindtextdomain ("gnunet-gtk",
+ path);
+ if (NULL != pd->gettext_path)
+ bindtextdomain (pd->gettext_domain,
+ pd->gettext_path);
+ textdomain (pd->gettext_domain);
+ bind_textdomain_codeset ("GNUnet",
+ "UTF-8");
+ bind_textdomain_codeset ("gnunet-gtk",
+ "UTF-8");
+ bind_textdomain_codeset (pd->gettext_domain,
+ "UTF-8");
GNUNET_free (path);
#else
fprintf (
@@ -71,20 +78,12 @@ get_filename_charset (const gchar **filename_charset)
gboolean is_utf8;
is_utf8 = g_get_filename_charsets (&charsets);
-
if (filename_charset)
*filename_charset = charsets[0];
-
return is_utf8;
}
-/**
- * Convert a string from the current locale to UTF-8.
- *
- * @param str_loc string in current locale
- * @return string in UTF-8, NULL if str_loc was NULL
- */
char *
GNUNET_GTK_from_loc_to_utf8 (const char *str_loc)
{
@@ -99,7 +98,9 @@ GNUNET_GTK_from_loc_to_utf8 (const char *str_loc)
if (is_UTF8)
str_utf8 = GNUNET_strdup (str_loc);
else
- str_utf8 = GNUNET_STRINGS_to_utf8 (str_loc, strlen (str_loc), loc_charset);
+ str_utf8 = GNUNET_STRINGS_to_utf8 (str_loc,
+ strlen (str_loc),
+ loc_charset);
return str_utf8;
}
@@ -125,18 +126,14 @@ from_filename_to_utf8 (gchar *filename)
str_utf8 = GNUNET_strdup (filename);
else
str_utf8 =
- GNUNET_STRINGS_to_utf8 (filename, strlen (filename), filename_charset);
+ GNUNET_STRINGS_to_utf8 (filename,
+ strlen (filename),
+ filename_charset);
return str_utf8;
}
-/**
- * Returns filename form filechooser, encoded in UTF-8.
- *
- * @param fc file chooser to inspect
- * @return selected filename as UTF-8, NULL on errors
- */
char *
GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser *fc)
{
@@ -150,4 +147,5 @@ GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser
*fc)
return filename_utf8;
}
+
/* end of nls.c */
diff --git a/src/lib/os_installation.c b/src/lib/os_installation.c
index 762ce3e6..7fc8d627 100644
--- a/src/lib/os_installation.c
+++ b/src/lib/os_installation.c
@@ -30,16 +30,19 @@
* for gnunet-gtk.
*/
static const struct GNUNET_OS_ProjectData gtk_pd =
- {.libname = "libgnunetgtk",
- .project_dirname = "gnunet",
- .binary_name = "gnunet-fs-gtk",
- .env_varname = "GNUNET_GTK_PREFIX",
- .env_varname_alt = "GNUNET_PREFIX",
- .base_config_varname = "GNUNET_BASE_CONFIG",
- .bug_email = "gnunet-developers@gnu.org",
- .homepage = "http://www.gnu.org/s/gnunet/",
- .config_file = "gnunet.conf",
- .user_config_file = "~/.config/gnunet.conf"};
+{.libname = "libgnunetgtk",
+ .project_dirname = "gnunet",
+ .binary_name = "gnunet-fs-gtk",
+ .env_varname = "GNUNET_GTK_PREFIX",
+ .env_varname_alt = "GNUNET_PREFIX",
+ .base_config_varname = "GNUNET_BASE_CONFIG",
+ .bug_email = "gnunet-developers@gnu.org",
+ .homepage = "http://www.gnu.org/s/gnunet/",
+ .config_file = "gnunet.conf",
+ .user_config_file = "~/.config/gnunet.conf",
+ .gettext_domain = "gnunet-gtk",
+ .version = PACKAGE_VERSION,
+ .is_gnu = 1};
/**
@@ -55,7 +58,8 @@ GNUNET_GTK_project_data_default (void)
/**
* Initialize libgnunetgtk.
*/
-void __attribute__ ((constructor)) GNUNET_GTK_init ()
+void __attribute__ ((constructor))
+GNUNET_GTK_init (void)
{
GNUNET_OS_init (>k_pd);
}
diff --git a/src/lib/trayicon.c b/src/lib/trayicon.c
index 1b8edd85..788f4f86 100644
--- a/src/lib/trayicon.c
+++ b/src/lib/trayicon.c
@@ -88,7 +88,9 @@ GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem, gpointer
user_data)
* @param user_data unused
*/
static int
-tray_icon_on_menu (GtkWidget *widget, GdkEvent *event, gpointer user_data)
+tray_icon_on_menu (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
struct GNUNET_GTK_MainLoop *ml = user_data;
GtkMenu *tray_menu;
@@ -103,7 +105,8 @@ tray_icon_on_menu (GtkWidget *widget, GdkEvent *event,
gpointer user_data)
builder =
GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml);
tray_menu = GTK_MENU (
- gtk_builder_get_object (builder, "GNUNET_GTK_status_bar_popup_menu"));
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_status_bar_popup_menu"));
g_object_ref (tray_menu);
gtk_menu_popup (tray_menu,
NULL,
@@ -161,13 +164,17 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop
*ml,
* @param tooltip tooltip for the tray icon
*/
void
-GNUNET_GTK_tray_icon_change (const char *icon_name, const char *tooltip)
+GNUNET_GTK_tray_icon_change (const char *icon_name,
+ const char *tooltip)
{
if (NULL == tray_icon)
return;
- gtk_status_icon_set_from_icon_name (tray_icon, icon_name);
- gtk_status_icon_set_tooltip_text (tray_icon, tooltip);
- gtk_status_icon_set_visible (tray_icon, TRUE);
+ gtk_status_icon_set_from_icon_name (tray_icon,
+ icon_name);
+ gtk_status_icon_set_tooltip_text (tray_icon,
+ tooltip);
+ gtk_status_icon_set_visible (tray_icon,
+ TRUE);
}
@@ -184,4 +191,5 @@ GNUNET_GTK_tray_icon_destroy ()
main_window = NULL;
}
+
/* end of trayicon.c */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet-gtk] branch master updated: -make gnunet-gtk respect NLS settings from GNUNET_OS-project data,
gnunet <=