From 5f48e596944cd7c12aeb4074758dde4451ddccea Mon Sep 17 00:00:00 2001 From: Perberos Date: Wed, 8 May 2013 07:51:17 -0300 Subject: fixed g_type_init() deprecation added Not without my gnu --- configure.ac | 18 ++++- distro/archlinux/PKGBUILD | 35 +++++----- mate-about/Makefile.am | 6 ++ mate-about/mate-about.c | 163 +++++++++++++++++++++++++++++++++++++--------- mate-about/mate-about.h | 8 ++- 5 files changed, 179 insertions(+), 51 deletions(-) diff --git a/configure.ac b/configure.ac index 8144c54..ce28760 100644 --- a/configure.ac +++ b/configure.ac @@ -189,7 +189,7 @@ PKG_CHECK_MODULES(XLIB, x11, [X11_PACKAGE= AC_PATH_XTRA if test "x$no_x" = xyes; then - AC_MSG_ERROR("no (requires X development libraries)") + AC_MSG_ERROR([no (requires X development libraries)]) else XLIB_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS" XLIB_CFLAGS=$X_CFLAGS @@ -227,6 +227,20 @@ dnl mate-doc-utils stuff MATE_DOC_INIT + +dnl GNU MATE logo + +AC_ARG_ENABLE([gnucat], + [AS_HELP_STRING([--enable-gnucat], [enable the use of gnu cat as logo in mate-about])], + [enable_gnucat=yes], [enable_gnucat=no]) + +if test "x$enable_gnucat" = "xyes"; then + MATE_ABOUT_CFLAGS="$MATE_ABOUT_CFLAGS -DGNUCAT_ENABLED=1" +fi + +AM_CONDITIONAL(GNUCAT_ENABLED, test "x$enable_gnucat" = "xyes") + + dnl Language Support GETTEXT_PACKAGE=mate-desktop @@ -343,4 +357,6 @@ mate-desktop $VERSION `echo mate-desktop $VERSION | sed "s/./=/g"` Startup notification support: ${have_startup_notification} XRandr support: ${have_randr} Build gtk-doc documentation: ${enable_gtk_doc} + + Enable gnucat: ${enable_gnucat} " diff --git a/distro/archlinux/PKGBUILD b/distro/archlinux/PKGBUILD index 5944a6a..077863b 100644 --- a/distro/archlinux/PKGBUILD +++ b/distro/archlinux/PKGBUILD @@ -1,10 +1,10 @@ pkgname=mate-desktop -pkgver=1.5.0 +pkgver=custom pkgrel=1 pkgdesc="Library with common API for various MATE modules" arch=(i686 x86_64) license=(GPL LGPL) -depends=('libunique' 'libmatenotify' 'hicolor-icon-theme' 'gvfs-obexftp' 'obexd-client') +depends=('libunique' 'hicolor-icon-theme' 'gvfs-obexftp' 'obexd-client') makedepends=('mate-doc-utils' 'intltool') options=('!emptydirs' '!libtool') url="http://mate-desktop.org/" @@ -14,24 +14,25 @@ sha256sums=() install=mate-desktop.install build() { - cd "${srcdir}/../../../" + cd "${srcdir}/../../../" - ./autogen.sh \ - --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --disable-scrollkeeper \ - --disable-startup-notification \ - --enable-unique || return 1 - # --with-gtk=3.0 - make || return 1 + ./autogen.sh \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-static \ + --disable-scrollkeeper \ + --disable-startup-notification \ + --enable-unique || return 1 + # --with-gtk=3.0 \ + # --enable-gnucat + make || return 1 } package() { - cd "${srcdir}/../../../" - make DESTDIR="$pkgdir" install + cd "${srcdir}/../../../" + make DESTDIR="$pkgdir" install - # prevent conflicts errors - mv "${pkgdir}/usr/share/omf" "${pkgdir}/usr/share/mate-omf" + # prevent conflicts errors + # mv "${pkgdir}/usr/share/omf" "${pkgdir}/usr/share/mate-omf" } diff --git a/mate-about/Makefile.am b/mate-about/Makefile.am index 51cbdb4..0d82bd8 100644 --- a/mate-about/Makefile.am +++ b/mate-about/Makefile.am @@ -1,4 +1,5 @@ bin_PROGRAMS = mate-about + mate_about_SOURCES = mate-about.c mate-about.h mate_about_CFLAGS = $(MATE_ABOUT_CFLAGS) $(UNIQUE_CFLAGS) mate_about_LDADD = $(MATE_ABOUT_LIBS) $(UNIQUE_LIBS) @@ -15,6 +16,11 @@ desktopdir = $(datadir)/applications desktop_in_files = mate-about.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +if GNUCAT_ENABLED +pixmapdir = $(datadir)/pixmaps +pixmap_DATA = gnu-cat_navideno_v3.png gnu-cat.gif +endif + CLEANFILES = mate-about.desktop mate-about #-include $(top_srcdir)/git.mk diff --git a/mate-about/mate-about.c b/mate-about/mate-about.c index f5f8496..fad8b31 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: nil; c-basic-offset: 4 -*- +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: yes; c-basic-offset: 4 -*- * * Copyright (C) 2011 Perberos * @@ -32,49 +32,141 @@ textdomain(package); #endif - #if GTK_CHECK_VERSION(3, 0, 0) && !defined(UNIQUE) +//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 void mate_about_on_activate(GtkApplication* app) - { - GList* list; - GtkWidget* window; + static gint frame = 1; - list = gtk_application_get_windows(app); + if (gdk_pixbuf_animation_iter_advance(object->iter, NULL)) + { + frame++; - if (list) - { - gtk_window_present(GTK_WINDOW(list->data)); - } - else - { - mate_about_run(); + gtk_about_dialog_set_logo((GtkAboutDialog*) object->widget, gdk_pixbuf_animation_iter_get_pixbuf(object->iter)); + } + + return TRUE; } - } - #elif GLIB_CHECK_VERSION(2, 26, 0) && !defined(UNIQUE) + #endif - // callback - static void mate_about_on_activate(GApplication* app) + 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 (!mate_about_dialog) - { - mate_about_run(); - } - else - { - gtk_window_present(GTK_WINDOW(mate_about_dialog)); - } - } + #if GTK_CHECK_VERSION(3, 0, 0) && !defined(UNIQUE) - #endif + 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 + } - void mate_about_run(void) + void + mate_about_run(void) { mate_about_dialog = (GtkAboutDialog*) gtk_about_dialog_new(); gtk_window_set_default_icon_name(icon); - #if GTK_CHECK_VERSION(3, 0, 0) || GTK_CHECK_VERSION(2, 6, 0) + + #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) gtk_about_dialog_set_logo_icon_name(mate_about_dialog, icon); @@ -134,13 +226,19 @@ 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"); - g_type_init(); + #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 /* http://www.gtk.org/api/2.6/glib/glib-Commandline-option-parser.html */ GOptionContext* context = g_option_context_new(NULL); @@ -209,5 +307,6 @@ return status; } +//} #endif diff --git a/mate-about/mate-about.h b/mate-about/mate-about.h index fd74b1c..131ddc4 100644 --- a/mate-about/mate-about.h +++ b/mate-about/mate-about.h @@ -30,10 +30,12 @@ #include #endif +//class mate-about +//{ const char* program_name = "MATE Desktop Environment"; const char* version = PACKAGE_VERSION; const char* icon = "desktop"; - const char* website = "http://www.mate-desktop.org/"; + const char* website = "http://mate-desktop.org/"; const char* copyright = "" "Copyright © 1997-2011 GNOME developers\n" @@ -628,6 +630,9 @@ const char* artists[] = { "Marcel Dijkstra ", "Rowen Stipe ", + #ifdef GNUCAT_ENABLED + "/g/entoomen (https://boards.4chan.org/g/)", + #endif "Wolfgang Ulbrich ", NULL }; @@ -665,5 +670,6 @@ {"version", 'v', 0, G_OPTION_ARG_NONE, &mate_about_nogui, "Show MATE version", NULL}, {NULL} }; +//} #endif /* __MATE_ABOUT_H__ */ -- cgit v1.2.1