Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

The applet is annoying

  • Loading branch information...
commit a6e1e7389c2555403fe462352bb05075d842c0b1 1 parent e11f90e
@nickg authored
Showing with 25 additions and 5 deletions.
  1. +1 −1  po/de_DE.po
  2. +1 −1  po/en_GB.po
  3. +1 −1  po/pt_BR.po
  4. +22 −2 src/applet.c
View
2  po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: xcowsay 1.0\n"
"Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n"
-"POT-Creation-Date: 2008-06-08 00:11+0100\n"
+"POT-Creation-Date: 2008-06-08 00:24+0100\n"
"PO-Revision-Date: 2008-05-31 20:29+0100\n"
"Last-Translator: Stefan Hajnoczi <stefanha@gmail.com>\n"
"Language-Team: German\n"
View
2  po/en_GB.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: xcowsay 0.7\n"
"Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n"
-"POT-Creation-Date: 2008-06-08 00:11+0100\n"
+"POT-Creation-Date: 2008-06-08 00:24+0100\n"
"PO-Revision-Date: 2008-05-23 17:45+0100\n"
"Last-Translator: Nick Gasson <nick@cakesniffer.co.uk>\n"
"Language-Team: English (British)\n"
View
2  po/pt_BR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: pt_BR\n"
"Report-Msgid-Bugs-To: nick@cakesniffer.co.uk\n"
-"POT-Creation-Date: 2008-06-08 00:11+0100\n"
+"POT-Creation-Date: 2008-06-08 00:24+0100\n"
"PO-Revision-Date: 2008-05-23 22:57-0300\n"
"Last-Translator: Phantom X <megaphantomx@bol.com.br>\n"
"Language-Team: Português do Brasil <pt@li.org>\n"
View
24 src/applet.c
@@ -17,6 +17,7 @@
#include <string.h>
#include <stdio.h>
+#include <assert.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -69,6 +70,8 @@ static gboolean on_button_press(GtkWidget *applet,
gpointer data)
{
int status;
+ char *buf;
+ FILE *pout;
// Don't react to anything other than a left click
if (event->button != 1)
@@ -82,13 +85,27 @@ static gboolean on_button_press(GtkWidget *applet,
}
else if (rc == daemon_pid) {
// Daemon has terminated
- printf("Daemon terminated -restarting\n");
+ printf("Daemon terminated - restarting\n");
restart_daemon();
}
else if (rc == -1) {
perror("waitpid");
abort();
}
+
+ buf = calloc(MAX_STDIN, 1);
+ assert(buf);
+ pout = popen("fortune", "r");
+ if (NULL == pout)
+ strcpy(buf, "Error: Failed to run fortune program!");
+ else {
+ fread(buf, 1, MAX_STDIN, pout);
+ fclose(pout);
+ }
+
+ display_cow_or_invoke_daemon(false, buf);
+
+ free(buf);
return TRUE;
}
@@ -113,6 +130,7 @@ static gboolean xcowsay_applet_fill(PanelApplet *applet,
gpointer data)
{
GtkWidget *image;
+ GdkWindow *win;
if (strcmp(iid, "OAFIID:CowsayApplet") != 0)
return FALSE;
@@ -130,8 +148,10 @@ static gboolean xcowsay_applet_fill(PanelApplet *applet,
"button_press_event",
G_CALLBACK(on_button_press),
image);
-
+
gtk_widget_show_all(GTK_WIDGET(applet));
+
+ gdk_window_set_back_pixmap(GTK_WIDGET(applet)->window, NULL, TRUE);
return TRUE;
}
Please sign in to comment.
Something went wrong with that request. Please try again.