summaryrefslogtreecommitdiff
path: root/mate-about/mate-about.c
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-05-08 13:02:30 +0200
committerStefano Karapetsas <[email protected]>2013-05-08 13:02:30 +0200
commit46305899fe8b58b890ef9c48b4271d1ea1c431ea (patch)
treeb08baef21a506c6e0fae5283d529645d119ec8ae /mate-about/mate-about.c
parent5f48e596944cd7c12aeb4074758dde4451ddccea (diff)
downloadmate-desktop-46305899fe8b58b890ef9c48b4271d1ea1c431ea.tar.bz2
mate-desktop-46305899fe8b58b890ef9c48b4271d1ea1c431ea.tar.xz
Fix previous hackering commit
Diffstat (limited to 'mate-about/mate-about.c')
-rw-r--r--mate-about/mate-about.c163
1 files changed, 32 insertions, 131 deletions
diff --git a/mate-about/mate-about.c b/mate-about/mate-about.c
index fad8b31..f5f8496 100644
--- a/mate-about/mate-about.c
+++ b/mate-about/mate-about.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: yes; c-basic-offset: 4 -*-
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2011 Perberos <[email protected]>
*
@@ -32,141 +32,49 @@
textdomain(package);
#endif
-//class mate-about <- pseudo-class!
-//{
- //translate me:
- // El codigo escrito aqui muestra un poco el desorden de lo que genera las
- // deprecations de las librerias, segun van evolucionando en sus diferentes
- // versiones.
-
- #ifdef GNUCAT_ENABLED
- // this function allow to display an animated image
- // Thanks! http://www.gtkforums.com/viewtopic.php?t=1639
- typedef struct iter_arg_s {
- GtkWidget* widget;
- GdkPixbufAnimation* animation;
- GdkPixbufAnimationIter* iter;
- } iter_arg_t;
-
- gboolean
- on_animation_frame(iter_arg_t* object)
- {
- if (object->widget == NULL)
- {
- return FALSE;
- }
-
- static gint frame = 1;
+ #if GTK_CHECK_VERSION(3, 0, 0) && !defined(UNIQUE)
- if (gdk_pixbuf_animation_iter_advance(object->iter, NULL))
- {
- frame++;
+ static void mate_about_on_activate(GtkApplication* app)
+ {
+ GList* list;
+ GtkWidget* window;
- gtk_about_dialog_set_logo((GtkAboutDialog*) object->widget, gdk_pixbuf_animation_iter_get_pixbuf(object->iter));
- }
+ list = gtk_application_get_windows(app);
- return TRUE;
+ if (list)
+ {
+ gtk_window_present(GTK_WINDOW(list->data));
}
+ else
+ {
+ mate_about_run();
+ }
+ }
- #endif
-
- static void
- mate_about_on_activate(
- #if GTK_CHECK_VERSION(3, 0, 0) && !defined(UNIQUE)
- GtkApplication* app
#elif GLIB_CHECK_VERSION(2, 26, 0) && !defined(UNIQUE)
- GApplication* app
- #endif
- )
- {
- #if GTK_CHECK_VERSION(3, 0, 0) && !defined(UNIQUE)
-
- GList* list;
- GtkWidget* window;
- list = gtk_application_get_windows(app);
-
- if (list)
- {
- gtk_window_present(GTK_WINDOW(list->data));
- }
- else
- {
- mate_about_run();
- }
-
- #elif GLIB_CHECK_VERSION(2, 26, 0) && !defined(UNIQUE)
-
- if (!mate_about_dialog)
- {
- mate_about_run();
- }
- else
- {
- gtk_window_present(GTK_WINDOW(mate_about_dialog));
- }
-
- #endif
+ // callback
+ static void mate_about_on_activate(GApplication* app)
+ {
+ if (!mate_about_dialog)
+ {
+ mate_about_run();
+ }
+ else
+ {
+ gtk_window_present(GTK_WINDOW(mate_about_dialog));
+ }
}
- void
- mate_about_run(void)
+ #endif
+
+ void mate_about_run(void)
{
mate_about_dialog = (GtkAboutDialog*) gtk_about_dialog_new();
gtk_window_set_default_icon_name(icon);
-
- #ifdef GNUCAT_ENABLED
-
- /* 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));
-
- if (g_date_get_month(d) == G_DATE_DECEMBER)
- {
- GDateDay day = g_date_get_day(d);
-
- if (day >= 24 && day <=25)
- {
- is_christmas = TRUE;
- }
- }
-
- g_date_free(d);
-
- 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);
- g_object_unref(pixbuf);
- }
- else
- {
- iter_arg_t animation_object;
- GdkPixbufAnimation* animation;
- GdkPixbufAnimationIter *iter;
- GtkWidget* image;
-
- animation = gdk_pixbuf_animation_new_from_file(PIXMAPS_DIR "gnu-cat.gif", NULL);
-
- if (animation != NULL)
- {
- iter = gdk_pixbuf_animation_get_iter(animation, NULL);
-
- animation_object.animation = animation;
- animation_object.iter = iter;
- animation_object.widget = (GtkWidget*) mate_about_dialog;
-
- gtk_about_dialog_set_logo(mate_about_dialog, gdk_pixbuf_animation_iter_get_pixbuf(iter));
-
- g_timeout_add(gdk_pixbuf_animation_iter_get_delay_time(iter), (GSourceFunc) on_animation_frame, (gpointer) &animation_object);
- }
- }
-
- #elif GTK_CHECK_VERSION(3, 0, 0) || GTK_CHECK_VERSION(2, 6, 0)
+ #if GTK_CHECK_VERSION(3, 0, 0) || GTK_CHECK_VERSION(2, 6, 0)
gtk_about_dialog_set_logo_icon_name(mate_about_dialog, icon);
@@ -226,19 +134,13 @@
gtk_widget_destroy((GtkWidget*) mate_about_dialog);
}
- int
- main(int argc, char** argv)
+ int main(int argc, char** argv)
{
int status = 0;
mate_gettext(GETTEXT_PACKAGE, LOCALE_DIR, "UTF-8");
- #if !GLIB_CHECK_VERSION(2, 36, 0)
- // g_type_init has been deprecated since version 2.36 and should not
- // be used in newly-written code. the type system is now initialised
- // automatically
- g_type_init();
- #endif
+ g_type_init();
/* http://www.gtk.org/api/2.6/glib/glib-Commandline-option-parser.html */
GOptionContext* context = g_option_context_new(NULL);
@@ -307,6 +209,5 @@
return status;
}
-//}
#endif