Hello community,
here is the log from the commit of package xfce4-session for openSUSE:Factory
checked in at Mon Mar 9 00:31:36 CET 2009.
--------
--- xfce4-session/xfce4-session.changes 2009-01-28 15:02:41.000000000 +0100
+++ /mounts/work_src_done/STABLE/xfce4-session/xfce4-session.changes 2009-03-02 16:17:28.000000000 +0100
@@ -1,0 +2,5 @@
+Mon Mar 2 16:10:39 CET 2009 - prusnak@suse.cz
+
+- xfce4-tips prints tips without calling fortune (tips-no-fortune.patch)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
xfce4-session-4.4.3.tar.bz2
xfce4-session-autostart-editor-crash.patch
xfce4-session-configure.patch
xfce4-session-faster-start.patch
xfce4-session-logout-dialog.patch
xfce4-session-ubuntu-icons.tar.bz2
New:
----
xfce4-session-4.6.0.tar.bz2
xfce4-session-4.6.0-tips-no-fortune.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xfce4-session.spec ++++++
--- /var/tmp/diff_new_pack.d16294/_old 2009-03-09 00:31:21.000000000 +0100
+++ /var/tmp/diff_new_pack.d16294/_new 2009-03-09 00:31:21.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package xfce4-session (Version 4.4.3)
+# spec file for package xfce4-session (Version 4.6.0)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,25 +19,20 @@
Name: xfce4-session
-BuildRequires: dbus-1-devel gtk2-devel libxml2-devel perl-XML-Parser startup-notification update-desktop-files xorg-x11
-%if 0%{?suse_version} > 1010
-BuildRequires: dbus-1-glib-devel
-%endif
-BuildRequires: intltool xfce-mcs-manager-devel >= 4.3
-Requires: fortune
Summary: Xfce Session manager
-Version: 4.4.3
-Release: 3
+Version: 4.6.0
+Release: 2
License: GPL v2 or later
Url: http://www.xfce.org/
-Source0: %{name}-%{version}.tar.bz2
-Source1: %{name}-ubuntu-icons.tar.bz2
-Patch0: %{name}-logout-dialog.patch
-Patch1: %{name}-faster-start.patch
-Patch2: %{name}-autostart-editor-crash.patch
-Patch3: %{name}-configure.patch
+Source: %{name}-%{version}.tar.bz2
+Patch0: %{name}-%{version}-tips-no-fortune.patch
Group: System/GUI/XFCE
BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildRequires: libwnck-devel libxfce4util-devel libxfcegui4-devel
+BuildRequires: dbus-1-glib-devel hal-devel libxfconf-devel
+BuildRequires: intltool perl-XML-Parser update-desktop-files xorg-x11
+Requires: %{name}-branding >= %{version}
+Recommends: fortune
%description
xfce4-session is the session manager for the Xfce desktop environment.
@@ -57,8 +52,8 @@
Summary: Xfce Session manager
Group: System/GUI/XFCE
Requires: %{name} = %{version}
-Requires: libxfcegui4-devel >= 4.3
-Requires: libxml2-devel
+Requires: libxfce4util-devel libxfcegui4-devel libwnck-devel
+Requires: dbus-1-glib-devel hal-devel libxfconf-devel
%description devel
xfce4-session is the session manager for the Xfce desktop environment.
@@ -73,31 +68,41 @@
Maarten Boekhold
Brian Tarricone
+%package branding-upstream
+License: GPL v2 or later
+Summary: Xfce Session manager
+Group: System/GUI/XFCE
+Provides: %{name}-branding = %{version}
+Conflicts: otherproviders(%{name}-branding)
+Supplements: packageand(%{name}:branding-upstream)
+
+%description branding-upstream
+xfce4-session is the session manager for the Xfce desktop environment.
+
+
+
+Authors:
+--------
+ Benedikt Meurer
+ Oliver M. Bolzer
+ Francois Le Clainche
+ Maarten Boekhold
+ Brian Tarricone
+
%prep
%setup -q
%patch0
-%patch1
-%patch2
%build
-%configure --disable-static --with-pic \
+%configure \
+ --disable-static \
--enable-session-screenshots
make %{?jobs:-j%jobs}
-%suse_update_desktop_file -i xfce-splash-settings X-XFCE Settings DesktopSettings
-%suse_update_desktop_file -i xfce-session-settings X-XFCE Settings DesktopSettings
-%suse_update_desktop_file -i xfce4-autostart-editor X-XFCE Settings DesktopSettings
-%suse_update_desktop_file -i xfce4-tips-autostart X-XFCE Settings DesktopSettings
%install
make DESTDIR=$RPM_BUILD_ROOT install
%find_lang %{name}
-mkdir -p $RPM_BUILD_ROOT/%{_datadir}
-# the icons for the hibernate and standby buttons
-cd $RPM_BUILD_ROOT/%{_datadir}
-tar xvfj $RPM_SOURCE_DIR/xfce4-session-ubuntu-icons.tar.bz2
-cd -
-rm -f $RPM_BUILD_ROOT/%{_datadir}/icons/hicolor/scalable/apps/xfsm-shutdown.svg
-%{__rm} -f %{buildroot}%{_libdir}/*.la
+rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/xfce4/splash/engines/*.la
%clean
rm -rf $RPM_BUILD_ROOT
@@ -105,36 +110,43 @@
%files -f %name.lang
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog ChangeLog.pre-xfce-devel NEWS README TODO
-%{_sysconfdir}/xdg/xfce4-session/
%{_bindir}/*
-%{_libdir}/xfce4/
-%{_libdir}/libxfsm-*
+%{_libdir}/xfce4
+%{_libdir}/*.so.*
%{_mandir}/*/*
%{_datadir}/themes/*
%{_datadir}/applications/*
%{_datadir}/icons/*/*
+%dir %{_datadir}/xfce4
%{_datadir}/xfce4/*
%{_libexecdir}/balou-export-theme
%{_libexecdir}/balou-install-theme
%{_libexecdir}/xfsm-shutdown-helper
-%if 0%{?suse_version} && 0%{?suse_version} < 1030
-%dir %{_sysconfdir}/xdg/autostart
-%endif
%{_sysconfdir}/xdg/autostart/xfce4-tips-autostart.desktop
+%postun -p /sbin/ldconfig
+
%post
-/sbin/ldconfig
%run_suseconfig -m gtk2
-
-%postun -p /sbin/ldconfig
+/sbin/ldconfig
%files devel
%defattr(-,root,root)
-%{_libdir}/pkgconfig/*
-%dir %{_includedir}/xfce4/xfce4-session-4.2
+%dir %{_includedir}/xfce4/*
%{_includedir}/xfce4/*/*
+%{_libdir}/pkgconfig/*
+%{_libdir}/*.so
+
+%files branding-upstream
+%defattr(-,root,root)
+%dir %{_sysconfdir}/xdg/xfce4
+%dir %{_sysconfdir}/xdg/xfce4/xfconf
+%dir %{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml
+%{_sysconfdir}/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml
%changelog
+* Mon Mar 02 2009 prusnak@suse.cz
+- xfce4-tips prints tips without calling fortune (tips-no-fortune.patch)
* Wed Jan 28 2009 crrodriguez@suse.de
- remove static libraries and "la" files
* Tue Nov 18 2008 pnemec@suse.cz
++++++ xfce4-session-4.4.3.tar.bz2 -> xfce4-session-4.6.0.tar.bz2 ++++++
++++ 160101 lines of diff (skipped)
++++++ xfce4-session-4.6.0-tips-no-fortune.patch ++++++
--- xfce4-tips/data/Makefile.am
+++ xfce4-tips/data/Makefile.am
@@ -1,10 +1,5 @@
tipsdir = $(datadir)/xfce4/tips
-tips_DATA = \
- tips \
- tips.dat
-
-tips.dat: $(srcdir)/tips
- strfile $(srcdir)/tips tips.dat
+tips_DATA = tips
EXTRA_DIST = $(tips_DATA)
--- xfce4-tips/main.c
+++ xfce4-tips/main.c
@@ -43,7 +43,8 @@
-static const gchar *titles[] = {
+static const gchar *titles[] =
+{
N_("Tips and Tricks"),
N_("Fortunes")
};
@@ -52,8 +53,65 @@
static GtkWidget *dlg = NULL;
static guint option = OPTION_TIPS;
+static gchar *fortune_cmd = NULL;
+static GPtrArray *tips = NULL;
+
+
+static void
+read_tips_from_file (void)
+{
+ gchar *data;
+ gchar *entry;
+ gsize len;
+ guint i, j;
+ GError *error = NULL;
+
+ /* read the whole file */
+ g_file_get_contents (TIPSDIR "/tips", &data, &len, &error);
+
+ tips = g_ptr_array_new ();
+ if (error != NULL)
+ {
+ g_ptr_array_add (tips, g_strdup_printf (_("Could not load tips database (%s)."),
+ error->message));
+ g_free (data);
+ g_error_free (error);
+ return;
+ }
+
+ entry = g_malloc (len + 1);
+ i = j = 0;
+ while (data[i])
+ {
+ if (data[i] == '%')
+ {
+ /* add a new tip */
+ entry[j] = '\0';
+ j = 0;
+ if (entry[0])
+ g_ptr_array_add (tips, g_strdup(entry));
+ /* skip the following line break character(s) */
+ if (data[i] == '\r' && (i + 1) < len && data[i + 1] == '\n')
+ i += 2;
+ else
+ i += 1;
+ }
+ else
+ entry[j++] = data[i];
+
+ i++;
+ }
+ g_free (data);
+ g_free (entry);
+}
+static void
+free_tip (gpointer data, gpointer user_data)
+{
+ g_free (data);
+}
+
static gboolean
autostart_enabled (void)
@@ -95,47 +153,93 @@
item_cb (GtkWidget *btn,
gpointer data)
{
- option = GPOINTER_TO_UINT(data);
+ option = GPOINTER_TO_UINT (data);
gtk_window_set_title (GTK_WINDOW (dlg), _(titles[option]));
}
+static gchar*
+run_fortune (void)
+{
+ GError *error = NULL;
+ gchar *out = NULL;
+ gchar *err = NULL;
+ gchar *buffer = NULL;
+
+ if (fortune_cmd != NULL && g_spawn_command_line_sync (fortune_cmd, &out, &err, NULL, &error))
+ {
+ if (out != NULL && *out != '\0')
+ {
+ /* check output for valid UTF-8 */
+ if (g_utf8_validate (out, -1, NULL))
+ buffer = out;
+ else
+ {
+ /* we got something else than UTF-8, try to convert it from the user's locale */
+ buffer = g_locale_to_utf8 (out, -1, NULL, NULL, NULL);
+ if (buffer == NULL)
+ {
+ /* converting it from the user's locale failed too, we give up */
+ buffer = g_strdup_printf (_("Invalid output of fortune."));
+ }
+ }
+ }
+ else
+ {
+ buffer = g_strdup_printf (_("Executing fortune failed (%s)"), err);
+ }
+ if (buffer != out)
+ g_free (out);
+ g_free(err);
+ }
+ else
+ {
+ buffer = g_strdup_printf (_("Executing fortune failed (%s)"), error->message);
+ g_error_free (error);
+ }
+
+ return buffer;
+}
+
+
+
static void
next_cb(GtkWidget *btn, GtkTextBuffer *textbuf)
{
- gchar buffer[1024];
+ gchar *buffer = NULL;
GtkTextIter start;
GtkTextIter end;
- FILE *fp;
/* clear the text buffer */
- gtk_text_buffer_get_bounds(textbuf, &start, &end);
- gtk_text_buffer_delete(textbuf, &start, &end);
+ gtk_text_buffer_get_bounds (textbuf, &start, &end);
+ gtk_text_buffer_delete (textbuf, &start, &end);
- switch (option) {
- case OPTION_TIPS:
- strcpy(buffer, "fortune " TIPSDIR "/tips");
- break;
-
- case OPTION_FORTUNES:
- strcpy(buffer, "fortune");
- break;
- }
-
- if ((fp = popen(buffer, "r")) == NULL) {
- perror("Unable to execute fortune");
- return;
- }
-
- while (fgets(buffer, sizeof(buffer), fp) != NULL) {
- gtk_text_buffer_get_end_iter(textbuf, &end);
- gtk_text_buffer_insert(textbuf, &end, buffer, -1);
- }
+ switch (option)
+ {
+ case OPTION_TIPS:
+ {
+ if (! tips || tips->len == 0)
+ buffer = _("Error while loading tips.");
+ else
+ /* no need to check or convert the encoding of our own tips file as it is already UTF-8 */
+ buffer = g_ptr_array_index (tips, g_random_int_range(0, tips->len));
+ break;
+ }
+ case OPTION_FORTUNES:
+ {
+ buffer = run_fortune ();
+ break;
+ }
+ }
- pclose (fp);
-}
+ /* add the text to the buffer */
+ gtk_text_buffer_get_end_iter (textbuf, &end);
+ gtk_text_buffer_insert (textbuf, &end, buffer, -1);
+ if (option == OPTION_FORTUNES)
+ g_free (buffer);
+}
int
@@ -152,9 +256,14 @@
GtkWidget *close;
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-
+
gtk_init (&argc, &argv);
+ /* test for fortune */
+ fortune_cmd = g_find_program_in_path ("fortune");
+
+ read_tips_from_file ();
+
/* fake a SM client id, so the session manager does not restart us */
gdk_set_sm_client_id ("FAKED CLIENTID");
@@ -193,25 +302,28 @@
gtk_box_pack_start (GTK_BOX (vbox2), check, FALSE, FALSE, 0);
gtk_widget_show (check);
- menu = gtk_menu_new ();
- gtk_widget_show (menu);
-
- item = gtk_menu_item_new_with_label (_("Tips and tricks"));
- g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_TIPS));
- g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- item = gtk_menu_item_new_with_label (_("Fortunes"));
- g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_FORTUNES));
- g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- gtk_widget_show (item);
-
- opt = gtk_option_menu_new();
- gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu);
- gtk_dialog_add_action_widget (GTK_DIALOG (dlg), opt, GTK_RESPONSE_NONE);
- gtk_widget_show(opt);
+ if (fortune_cmd != NULL)
+ {
+ menu = gtk_menu_new ();
+ gtk_widget_show (menu);
+
+ item = gtk_menu_item_new_with_label (titles[OPTION_TIPS]);
+ g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_TIPS));
+ g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
+ item = gtk_menu_item_new_with_label (titles[OPTION_FORTUNES]);
+ g_signal_connect (item, "activate", G_CALLBACK (item_cb), GUINT_TO_POINTER (OPTION_FORTUNES));
+ g_signal_connect (item, "activate", G_CALLBACK (next_cb), gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show (item);
+
+ opt = gtk_option_menu_new();
+ gtk_option_menu_set_menu(GTK_OPTION_MENU(opt), menu);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg), opt, GTK_RESPONSE_NONE);
+ gtk_widget_show(opt);
+ }
next = gtk_button_new_with_label (_("Next"));
gtk_dialog_add_action_widget (GTK_DIALOG (dlg), next, GTK_RESPONSE_NONE);
@@ -232,5 +344,14 @@
gtk_main ();
+
+ /* cleanup */
+ g_free (fortune_cmd);
+ if (tips != NULL)
+ {
+ g_ptr_array_foreach (tips, free_tip, NULL);
+ g_ptr_array_free (tips, TRUE);
+ }
+
return EXIT_SUCCESS;
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org