1
0
forked from pool/xfce4-session

Accepting request 54791 from X11:xfce

Accepted submit request 54791 from user anubisg1

OBS-URL: https://build.opensuse.org/request/show/54791
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/xfce4-session?expand=0&rev=23
This commit is contained in:
Lars Vogdt 2010-12-05 21:51:34 +00:00 committed by Git OBS Bridge
parent c9ead84f8c
commit 1514136cfb
6 changed files with 73 additions and 371 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:725e269254c34c530acb670f5ccd0fd69b57cbe9f2176abd8499fc5d6dcd30a8
size 1385541

View File

@ -0,0 +1,12 @@
diff -ur xfce4-session-4.7.1.orig/xfce4-session/xfsm-global.c xfce4-session-4.7.1/xfce4-session/xfsm-global.c
--- xfce4-session-4.7.1.orig/xfce4-session/xfsm-global.c 2010-11-03 21:11:37.000000000 +0100
+++ xfce4-session-4.7.1/xfce4-session/xfsm-global.c 2010-11-26 17:34:35.000000000 +0100
@@ -45,6 +45,8 @@
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
+#include <libxfsm/xfsm-util.h>
+
#include <xfce4-session/shutdown.h>
#include <xfce4-session/xfsm-global.h>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ee970da59a1433efd4c321794134e4af202ba7b6375ebaf63c84fc246877ee0
size 1460911

View File

@ -1,291 +0,0 @@
--- 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;
}

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Fri Dec 3 14:44:54 UTC 2010 - gber@opensuse.org
- require xfce4-utils
-------------------------------------------------------------------
Wed Dec 1 18:11:04 UTC 2010 - prusnak@opensuse.org
- use pkgconfig symbol in BuildRequires
-------------------------------------------------------------------
Fri Nov 26 16:36:08 UTC 2010 - gber@opensuse.org
- added xfce4-session-4.7.1-fix-missing-include.patch to fix
missing include
-------------------------------------------------------------------
Sun Jul 18 13:46:55 CEST 2010 - bernhard@bwalle.de

View File

@ -1,80 +1,56 @@
#
# spec file for package xfce4-session (Version 4.6.2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: xfce4-session
Summary: Xfce Session manager
Version: 4.6.2
Version: 4.7.1
Release: 1
License: GPLv2+
Summary: Xfce Session manager
Url: http://www.xfce.org/
Source: %{name}-%{version}.tar.bz2
Patch0: %{name}-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 libxfconf-devel
BuildRequires: intltool perl-XML-Parser update-desktop-files xorg-x11
Source: %{name}-%{version}.tar.bz2
Patch0: xfce4-session-4.7.1-fix-missing-include.patch
BuildRequires: intltool
BuildRequires: perl-XML-Parser
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: pkgconfig(libwnck-1.0)
BuildRequires: pkgconfig(libxfce4ui-1)
BuildRequires: pkgconfig(libxfce4util-1.0)
BuildRequires: pkgconfig(libxfcegui4-1.0)
BuildRequires: pkgconfig(libxfconf-0)
BuildRequires: update-desktop-files
BuildRequires: xorg-x11
Requires: %{name}-branding >= %{version}
Requires: xfce4-utils
Recommends: fortune
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
xfce4-session is the session manager for the Xfce desktop environment.
Authors:
--------
Benedikt Meurer <benny@xfce.org>
Oliver M. Bolzer <oliver@debian.org>
Francois Le Clainche <fleclainche@wanadoo.fr>
Maarten Boekhold <boekhold@emirates.net.ae>
Brian Tarricone <kelnos@xfce.org>
%package devel
License: GPLv2+
Summary: Xfce Session manager
Group: System/GUI/XFCE
Requires: %{name} = %{version}
Requires: libxfce4util-devel libxfcegui4-devel libwnck-devel
Requires: dbus-1-glib-devel libxfconf-devel
Requires: pkgconfig(dbus-glib-1)
Requires: pkgconfig(libwnck-1.0)
Requires: pkgconfig(libxfce4ui-1)
Requires: pkgconfig(libxfce4util-1.0)
Requires: pkgconfig(libxfcegui4-1.0)
Requires: pkgconfig(libxfconf-0)
%description devel
xfce4-session is the session manager for the Xfce desktop environment.
Authors:
--------
Benedikt Meurer <benny@xfce.org>
Oliver M. Bolzer <oliver@debian.org>
Francois Le Clainche <fleclainche@wanadoo.fr>
Maarten Boekhold <boekhold@emirates.net.ae>
Brian Tarricone <kelnos@xfce.org>
%package branding-upstream
License: GPLv2+
Summary: Xfce Session manager
Group: System/GUI/XFCE
Supplements: packageand(%{name}:branding-upstream)
Provides: %{name}-branding = %{version}
Conflicts: otherproviders(%{name}-branding)
Supplements: packageand(%{name}:branding-upstream)
%if 0%{?suse_version} >= 1120
BuildArch: noarch
%endif
@ -82,61 +58,50 @@ BuildArch: noarch
%description branding-upstream
xfce4-session is the session manager for the Xfce desktop environment.
Authors:
--------
Benedikt Meurer <benny@xfce.org>
Oliver M. Bolzer <oliver@debian.org>
Francois Le Clainche <fleclainche@wanadoo.fr>
Maarten Boekhold <boekhold@emirates.net.ae>
Brian Tarricone <kelnos@xfce.org>
%prep
%setup -q
%patch0
%patch0 -p1
%build
%configure \
--disable-static \
--enable-session-screenshots
make %{?jobs:-j%jobs}
make %{?_smp_mflags}
%install
make DESTDIR=$RPM_BUILD_ROOT install
%make_install
%find_lang %{name}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/xfce4/splash/engines/*.la
rm -f %{buildroot}%{_libdir}/*.la %{buildroot}%{_libdir}/xfce4/splash/engines/*.la
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%post
%run_suseconfig -m gtk2
/sbin/ldconfig
%postun -p /sbin/ldconfig
%files -f %name.lang
%defattr(-,root,root)
%doc AUTHORS BUGS COPYING ChangeLog ChangeLog.pre-xfce-devel NEWS README TODO
%{_bindir}/*
%doc AUTHORS BUGS COPYING ChangeLog NEWS README TODO
%{_bindir}/xfce4-session
%{_bindir}/xfce4-session-logout
%{_bindir}/xfce4-session-settings
%{_bindir}/xfce4-tips
%{_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
%{_datadir}/xfce4/
%{_datadir}/doc/xfce4-session
%{_sysconfdir}/xdg/autostart/xfce4-tips-autostart.desktop
%postun -p /sbin/ldconfig
%post
%run_suseconfig -m gtk2
/sbin/ldconfig
%files devel
%defattr(-,root,root)
%dir %{_includedir}/xfce4/*
%{_includedir}/xfce4/*/*
%{_includedir}/xfce4/*/
%{_libdir}/pkgconfig/*
%{_libdir}/*.so