gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1278 - in gnunet-gtk/src: common include plugins/about plu


From: grothoff
Subject: [GNUnet-SVN] r1278 - in gnunet-gtk/src: common include plugins/about plugins/daemon plugins/fs
Date: Tue, 5 Jul 2005 15:03:04 -0700 (PDT)

Author: grothoff
Date: 2005-07-05 15:02:57 -0700 (Tue, 05 Jul 2005)
New Revision: 1278

Modified:
   gnunet-gtk/src/common/helper.c
   gnunet-gtk/src/include/gnunetgtk_common.h
   gnunet-gtk/src/plugins/about/about.c
   gnunet-gtk/src/plugins/daemon/daemon.c
   gnunet-gtk/src/plugins/fs/download.c
Log:
die gui message, die

Modified: gnunet-gtk/src/common/helper.c
===================================================================
--- gnunet-gtk/src/common/helper.c      2005-07-05 21:51:22 UTC (rev 1277)
+++ gnunet-gtk/src/common/helper.c      2005-07-05 22:02:57 UTC (rev 1278)
@@ -1,5 +1,6 @@
 /*
      This file is part of GNUnet
+     (C) 2003, 2004, 2005 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -144,78 +145,6 @@
   return FALSE;
 }
 
-/**
- * A callback to destroy any widget given as second argument
- */
-static void 
-destroyWidget(GtkWidget * dummy, 
-             GtkWidget * widget) {
-  gtk_widget_destroy(widget);
-}
-
-/**
- * Callback function for guiMessage()
- *
- * FIXME: use GLADE (or direct GTK functionality) here!
- */
-static void doGuiMessage(void * args) {
-  const gchar * msg = args;
-  GtkWidget * window;
-  GtkWidget * label;
-  GtkWidget * box;
-  GtkWidget * button;
-
-  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_container_set_border_width(GTK_CONTAINER(window), 10);
-  gtk_window_set_title(GTK_WINDOW(window), 
-                      _("Notification"));
-  gtk_signal_connect(GTK_OBJECT(window), 
-                    "delete_event",
-                    GTK_SIGNAL_FUNC(deleteEvent), 
-                    NULL);
-
-  box = gtk_vbox_new(FALSE, 0);
-  gtk_container_add(GTK_CONTAINER(window), 
-                   box);
-
-  label = gtk_label_new(msg);
-  gtk_box_pack_start(GTK_BOX(box),
-                    label,
-                    FALSE,
-                    FALSE,
-                    0);
-  
-  button = gtk_button_new_with_label(_("Ok"));
-  gtk_signal_connect(GTK_OBJECT (button),
-                    "clicked",
-                    GTK_SIGNAL_FUNC(destroyWidget),
-                    window);
-  gtk_box_pack_start(GTK_BOX(box),
-                    button,
-                    FALSE,
-                    FALSE,
-                    0);  
-  gtk_window_set_position(GTK_WINDOW(window),
-                         GTK_WIN_POS_MOUSE);
-  gtk_widget_show_all(window);
-  gtk_widget_grab_focus(button);
-}
-
-/** 
- * Displays an informative message to the user in a fresh window 
- */
-void guiMessage(const char * format,
-               ...) {
-  va_list args;
-  gchar *note;
-
-  va_start(args, format);
-  note = g_strdup_vprintf(format, args);
-  va_end(args);  
-  gtkSaveCall(&doGuiMessage, note);
-  free(note);
-}
-
 static void hideWindow(GtkWidget * widget,
                       gpointer data) {
   if (widget != NULL)

Modified: gnunet-gtk/src/include/gnunetgtk_common.h
===================================================================
--- gnunet-gtk/src/include/gnunetgtk_common.h   2005-07-05 21:51:22 UTC (rev 
1277)
+++ gnunet-gtk/src/include/gnunetgtk_common.h   2005-07-05 22:02:57 UTC (rev 
1278)
@@ -42,19 +42,13 @@
 GladeXML * getMainXML(void);
 
 /**
- * Displays an informative message to the user
- * in a new popup window.
- */
-void guiMessage(const char * format,
-               ...);
-
-/**
  * Appends a message to the info window 
  * @param doPopup if YES, the info window will
  *   be opened
  */
 void infoMessage(int doPopup, 
-                const char * format, ...);
+                const char * format, 
+                ...);
 
 /** 
  * Appends a log entry to the info window

Modified: gnunet-gtk/src/plugins/about/about.c
===================================================================
--- gnunet-gtk/src/plugins/about/about.c        2005-07-05 21:51:22 UTC (rev 
1277)
+++ gnunet-gtk/src/plugins/about/about.c        2005-07-05 22:02:57 UTC (rev 
1278)
@@ -1,5 +1,6 @@
 /*
      This file is part of GNUnet
+     (C) 2005 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published

Modified: gnunet-gtk/src/plugins/daemon/daemon.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.c      2005-07-05 21:51:22 UTC (rev 
1277)
+++ gnunet-gtk/src/plugins/daemon/daemon.c      2005-07-05 22:02:57 UTC (rev 
1278)
@@ -122,7 +122,16 @@
   
   if (OK == checkGNUnetDaemonRunning() ) {
     if (OK != stopGNUnetDaemon()) {
-      guiMessage(_("Error requesting shutdown by gnunetd."));
+      GtkWidget * dialog;
+
+      dialog = gtk_message_dialog_new 
+       (NULL,
+        GTK_DIALOG_MODAL,
+        GTK_MESSAGE_ERROR,
+        GTK_BUTTONS_CLOSE,
+        _("Error requesting shutdown of gnunetd."));
+      gtk_dialog_run(GTK_DIALOG(dialog));
+      gtk_widget_destroy(dialog);  
     } else {
       addLogEntry(_("Terminating gnunetd..."));
     }

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2005-07-05 21:51:22 UTC (rev 
1277)
+++ gnunet-gtk/src/plugins/fs/download.c        2005-07-05 22:02:57 UTC (rev 
1278)
@@ -168,12 +168,22 @@
     pfx[strlen(pfx)-1] = '\0';
   if (0 == STAT(pfx,
                &sbuf)) {
-    guiMessage(_("File '%s' exists in '%s',\n"
-                "will store download under its GNUnet URI '%s' instead.\n"),
-              name,
-              fn,
-              &filename[strlen(ECRS_URI_PREFIX) +
-                        strlen(ECRS_FILE_INFIX)]);              
+    GtkWidget * dialog;
+    
+    dialog = gtk_message_dialog_new 
+      (NULL,
+       GTK_DIALOG_MODAL,
+       GTK_MESSAGE_WARNING,
+       GTK_BUTTONS_CLOSE,
+       _("File '%s' exists in '%s',\n"
+        "will store download under its"
+        " GNUnet URI '%s' instead.\n"),
+       name,
+       fn,
+       &filename[strlen(ECRS_URI_PREFIX) +
+                strlen(ECRS_FILE_INFIX)]);
+    gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_destroy(dialog);  
     strcpy(pfx, fn);
     strcat(pfx, 
           DIR_SEPARATOR_STR);
@@ -198,7 +208,8 @@
                     DOWNLOAD_PROGRESS, 0, /* progress */
                     DOWNLOAD_URISTRING, filename,
                     DOWNLOAD_URI, ECRS_dupUri(uri),
-                    DOWNLOAD_TREEPATH, list->rr, /* internal: row reference! */
+                    DOWNLOAD_TREEPATH, list->rr, 
+                    /* internal: row reference! */
                     -1);
   FREE(filename);
   FREE(name);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]