summaryrefslogtreecommitdiff
path: root/mate-about
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-10-18 00:22:20 +0200
committerStefano Karapetsas <[email protected]>2012-10-18 00:22:20 +0200
commitd54a8a85e7edec7e65ad42c9c183384f488a6f1c (patch)
tree12ef6a878cfe0f602fb2e5ee4ed08e72924e7b20 /mate-about
parenta27d841dcdfa30f070bf1d6e7a659a22ae1057ec (diff)
downloadmate-desktop-d54a8a85e7edec7e65ad42c9c183384f488a6f1c.tar.bz2
mate-desktop-d54a8a85e7edec7e65ad42c9c183384f488a6f1c.tar.xz
mate-aboud: code improvements
disable gnucat by default install gnucat pixmaps only if enabled translate some spanish comments dropped support for old glib version (now minimun version is increased) add "translator-credits" msgid to show translators
Diffstat (limited to 'mate-about')
-rw-r--r--mate-about/Makefile.am2
-rw-r--r--mate-about/mate-about.c80
-rw-r--r--mate-about/mate-about.h68
3 files changed, 40 insertions, 110 deletions
diff --git a/mate-about/Makefile.am b/mate-about/Makefile.am
index bd64542..055a031 100644
--- a/mate-about/Makefile.am
+++ b/mate-about/Makefile.am
@@ -11,8 +11,10 @@ AM_CPPFLAGS = \
@INTLTOOL_DESKTOP_RULE@
+if GNUCAT_ENABLED
pixmapdir = $(datadir)/pixmaps
pixmap_DATA = gnu-cat_navideno_v3.png gnu-cat.gif
+endif
desktopdir = $(datadir)/applications
desktop_in_files = mate-about.desktop.in
diff --git a/mate-about/mate-about.c b/mate-about/mate-about.c
index 9626542..8773261 100644
--- a/mate-about/mate-about.c
+++ b/mate-about/mate-about.c
@@ -32,10 +32,8 @@
textdomain(package);
#endif
-//class mate_about
-//{
// what a mess!
- #ifndef DISABLE_GNUCAT
+ #ifdef ENABLE_GNUCAT
// Thanks! http://www.gtkforums.com/viewtopic.php?t=1639
typedef struct _iter_arg {
@@ -85,7 +83,8 @@
}
#elif GLIB_CHECK_VERSION(2, 26, 0) && !defined(UNIQUE)
- // es un callback
+
+ // callback
static void mate_about_on_activate(GApplication* app)
{
if (!mate_about_dialog)
@@ -102,16 +101,14 @@
void mate_about_run(void)
{
- /* Es importante llamar gtk_init, si no, no se puede iniciar bien el dialogo */
mate_about_dialog = (GtkAboutDialog*) gtk_about_dialog_new();
gtk_window_set_default_icon_name(icon);
- #ifndef DISABLE_GNUCAT
+ #ifdef ENABLE_GNUCAT
- /* hacemos una comprovacion de la fecha, para mostrar el gnucat
- * version navideña. */
- gboolean christmas_is = FALSE;
+ /* check if it's christmas, to show a different image */
+ gboolean is_christmas = FALSE;
GDate* d = g_date_new();
g_date_set_time_t(d, (time_t) time(NULL));
@@ -122,14 +119,13 @@
if (day >= 24 && day <=25)
{
- christmas_is = TRUE;
+ is_christmas = TRUE;
}
}
g_date_free(d);
-
- if (christmas_is == TRUE)
+ if (is_christmas == TRUE)
{
GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "gnu-cat_navideno_v3.png", NULL);
gtk_about_dialog_set_logo(mate_about_dialog, pixbuf);
@@ -175,7 +171,7 @@
#endif
- //name
+ // name
#if GTK_CHECK_VERSION(3, 0, 0) || GTK_CHECK_VERSION(2, 12, 0)
gtk_about_dialog_set_program_name(mate_about_dialog, gettext(program_name));
#else
@@ -185,7 +181,7 @@
// version
gtk_about_dialog_set_version(mate_about_dialog, version);
- // creditos y pagina web
+ // credits and website
gtk_about_dialog_set_copyright(mate_about_dialog, copyright);
gtk_about_dialog_set_website(mate_about_dialog, website);
@@ -195,12 +191,12 @@
*/
gtk_about_dialog_set_comments(mate_about_dialog, gettext(comments_array[g_random_int_range(0, comments_count - 1)]));
- // autores
gtk_about_dialog_set_authors(mate_about_dialog, authors);
- // I comment this because the list is empty
gtk_about_dialog_set_artists(mate_about_dialog, artists);
gtk_about_dialog_set_documenters(mate_about_dialog, documenters);
- gtk_about_dialog_set_translator_credits(mate_about_dialog, translators);
+ /* Translators should localize the following string which will be
+ * displayed in the about box to give credit to the translator(s). */
+ gtk_about_dialog_set_translator_credits(mate_about_dialog, _("translator-credits"));
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_about_dialog_set_license_type(mate_about_dialog, GTK_LICENSE_GPL_3_0);
@@ -222,44 +218,19 @@
{
int status = 0;
- /* Con esto se inicia gettext
- * GETTEXT_PACKAGE = mate-desktop-2.0
- * LOCALE_DIR = /usr/local/share/locale */
mate_gettext(GETTEXT_PACKAGE, LOCALE_DIR, "UTF-8");
g_type_init();
-
-
- #ifdef G_OPTIONS_ENTRY_USE
- /* http://www.gtk.org/api/2.6/glib/glib-Commandline-option-parser.html */
- GOptionContext* context = g_option_context_new(NULL);
- g_option_context_add_main_entries(context, command_entries, GETTEXT_PACKAGE);
- g_option_context_add_group(context, gtk_get_option_group(TRUE));
- g_option_context_parse(context, &argc, &argv, NULL);
-
- /* Not necesary at all, program just run and die.
- * But it free a little memory. */
- g_option_context_free(context);
- #else
- int opt; /* este valor entrega el tipo de argumento */
-
- while ((opt = getopt_long(argc, argv, "+", command_entries, NULL)) != -1)
- {
- switch (opt)
- {
- case '?':
- return 1;
- case OPTION_VERSION:
- mate_about_nogui = TRUE;
- break;
- #ifdef CMDLINE_PROCESS
- CMDLINE_PROCESS
- #endif
- }
- }
- #endif
-
-
+
+ /* http://www.gtk.org/api/2.6/glib/glib-Commandline-option-parser.html */
+ GOptionContext* context = g_option_context_new(NULL);
+ g_option_context_add_main_entries(context, command_entries, GETTEXT_PACKAGE);
+ g_option_context_add_group(context, gtk_get_option_group(TRUE));
+ g_option_context_parse(context, &argc, &argv, NULL);
+
+ /* Not necesary at all, program just run and die.
+ * But it free a little memory. */
+ g_option_context_free(context);
if (mate_about_nogui == TRUE)
{
@@ -270,7 +241,7 @@
gtk_init(&argc, &argv);
/**
- * Ejemplos tomados de:
+ * Examples taken from:
* http://developer.gnome.org/gtk3/3.0/gtk-migrating-GtkApplication.html
*/
#ifdef USE_UNIQUE
@@ -310,12 +281,13 @@
g_object_unref(mate_about_application);
#else
+
mate_about_run();
+
#endif
}
return status;
}
-//}
#endif
diff --git a/mate-about/mate-about.h b/mate-about/mate-about.h
index a6ec12a..cbb2f5a 100644
--- a/mate-about/mate-about.h
+++ b/mate-about/mate-about.h
@@ -30,22 +30,6 @@
#include <unique/unique.h>
#endif
-/* "Commandline option parser" fue introducida a la GLIB a partir de la
- * version 2.6, esta definicion es para la compatibilidad GTK1.2 */
-#if GLIB_CHECK_VERSION(2, 6, 0)
- #define G_OPTIONS_ENTRY_USE
-#endif
-
-/* Debido a que GOptions no está disponible en GLIB versiones inferiores a 2.6
- * voy a utilizar la alternativa de GNU C, */
-#ifdef G_OPTIONS_ENTRY_USE
- /* No hay nesecidad de incluir nada, viene por defecto en <glib/glib.h> */
-#else
- #include <getopt.h>
-#endif
-
-//class mate_about
-//{
const char* program_name = "MATE Desktop Environment";
const char* version = PACKAGE_VERSION;
const char* icon = "desktop";
@@ -55,9 +39,8 @@
"Copyright © 1997-2011 GNOME developers\n"
"Copyright © 2011 Perberos"; // egoista!
- /* Incrementar el valor de comments_count si se desea agregar nuevos valores
- * en comments[]. Porque, este valor es usado en un random para obtener el
- * indice de la cadena. */
+ /* Increment comments_count if you add other comments. This will be
+ * used to choose a random comment. */
const int comments_count = 6;
const char* comments_array[] = {
N_("MATE provides an intuitive and attractive desktop to Linux users "
@@ -82,13 +65,13 @@
};
const char* authors[] = {
- // MATE start here
+ // MATE developers
"Perberos <[email protected]>",
"Stefano Karapetsas <[email protected]>",
"Steve Zesch <[email protected]>",
"Clement Lefebvre <[email protected]>",
"Nelson Marques <[email protected]>",
- // GNOME start here
+ // GNOME developers
"Jérôme Abela",
"Rob Adams",
"Djihed Afifi",
@@ -623,28 +606,23 @@
NULL
};
- // documentacion
+ // documentation
const char* documenters[] = {
"...", // TODO: fillme
NULL
};
- // artistas
+ // artists
const char* artists[] = {
"Rowen Stipe <[email protected]>",
"/g/entoomen <https://boards.4chan.org/g/>",
NULL
};
- // traductores
- const char translators[] = "" \
- "..."; // TODO: fillme
- // widget de la unica ventana
+ // widget for mate-about window
GtkAboutDialog* mate_about_dialog = FALSE;
// libunique thing
#ifdef USE_UNIQUE
- //extern UniqueApp* unique;
- //UniqueApp* unique = NULL;
extern UniqueApp* mate_about_application;
UniqueApp* mate_about_application = NULL;
#elif GTK_CHECK_VERSION(3, 0, 0)
@@ -668,32 +646,10 @@
static void mate_about_on_activate(GApplication* app);
#endif
- // for command line
- #ifdef G_OPTIONS_ENTRY_USE
- /* GOptionEntry ofrese la posibilidad de acceder a las opciones extras
- * de GTK desde la linea de comandos. Tambien muestra automaticamente
- * las opciones al llamar --help o -h */
- static GOptionEntry command_entries[] = {
- {"version", 'v', 0, G_OPTION_ARG_NONE, &mate_about_nogui, "Show release version", NULL},
- {NULL}
- };
- #else
-
-
- /* Quizás hay que agregar una opcion para --help
- */
- static struct option command_entries[] = {
- #ifdef CMDLINE_OPTIONS
- CMDLINE_OPTIONS
- #endif
-
- #define OPTION_VERSION 1000
- {"version", no_argument, NULL, OPTION_VERSION},
-
- {NULL, 0, NULL, 0}
- };
- #endif
-
-//}
+ // arguments definitions
+ static GOptionEntry command_entries[] = {
+ {"version", 'v', 0, G_OPTION_ARG_NONE, &mate_about_nogui, "Show MATE version", NULL},
+ {NULL}
+ };
#endif /* __MATE_ABOUT_H__ */