aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-11-08 05:20:30 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-11-08 05:20:30 +0800
commitb0978f82a3a5f2869bab4cfb1b5036bc3cc8f3e0 (patch)
treee6975a4d32699cffbd2c5c2898b1609c1301c406
parent19414d4335bf0b3e2a07435d967c4756540c8aaa (diff)
downloadgsoc2013-evolution-b0978f82a3a5f2869bab4cfb1b5036bc3cc8f3e0.tar.gz
gsoc2013-evolution-b0978f82a3a5f2869bab4cfb1b5036bc3cc8f3e0.tar.zst
gsoc2013-evolution-b0978f82a3a5f2869bab4cfb1b5036bc3cc8f3e0.zip
Use GtkDialog instead of GnomeDialog here.
2002-11-07 Jeffrey Stedfast <fejj@ximian.com> * filter-rule.c (validate): Use GtkDialog instead of GnomeDialog here. * filter-input.c (validate): Use GtkDialog instead of GnomeDialog here. * filter-folder.c (validate): Use GtkDialog instead of GnomeDialog here. * filter-file.c (validate): Use GtkDialog instead of GnomeDialog here. * rule-editor.c: Subclass GtkDialog instead of GnomeDialog. * filter-datespec.c (validate): Use GtkDialog instead of GnomeDialog. (button_clicked): Same. svn path=/trunk/; revision=18635
-rw-r--r--filter/ChangeLog20
-rw-r--r--filter/filter-datespec.c36
-rw-r--r--filter/filter-file.c30
-rw-r--r--filter/filter-folder.c15
-rw-r--r--filter/filter-input.c33
-rw-r--r--filter/filter-label.c2
-rw-r--r--filter/filter-part.c48
-rw-r--r--filter/filter-rule.c15
-rw-r--r--filter/rule-editor.c21
-rw-r--r--filter/rule-editor.h7
10 files changed, 131 insertions, 96 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index a2bc43d55b..e8dc82fc0c 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,23 @@
+2002-11-07 Jeffrey Stedfast <fejj@ximian.com>
+
+ * filter-rule.c (validate): Use GtkDialog instead of GnomeDialog
+ here.
+
+ * filter-input.c (validate): Use GtkDialog instead of GnomeDialog
+ here.
+
+ * filter-folder.c (validate): Use GtkDialog instead of GnomeDialog
+ here.
+
+ * filter-file.c (validate): Use GtkDialog instead of GnomeDialog
+ here.
+
+ * rule-editor.c: Subclass GtkDialog instead of GnomeDialog.
+
+ * filter-datespec.c (validate): Use GtkDialog instead of
+ GnomeDialog.
+ (button_clicked): Same.
+
2002-11-06 Jeffrey Stedfast <fejj@ximian.com>
* filter-label.c (xml_create): Deleted most of the internals until
diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c
index 247a3c1a90..197140218d 100644
--- a/filter/filter-datespec.c
+++ b/filter/filter-datespec.c
@@ -32,8 +32,6 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include <glade/glade.h>
#include "filter-datespec.h"
@@ -164,12 +162,20 @@ static gboolean
validate (FilterElement *fe)
{
FilterDatespec *fds = (FilterDatespec *) fe;
+ GtkWidget *dialog;
gboolean valid;
valid = fds->type != FDST_UNKNOWN;
if (!valid) {
- GtkWidget *gd = gnome_ok_dialog (_("You must choose a date."));
- gnome_dialog_run_and_close (GNOME_DIALOG (gd));
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", _("You must choose a date."));
+
+ gtk_dialog_run ((GtkDialog *) dialog);
}
return valid;
@@ -385,8 +391,9 @@ set_option_relative (GtkMenu *menu, FilterDatespec *fds)
}
static void
-dialog_clicked (GnomeDialog *gd, int button, FilterDatespec *fds)
+dialog_response (GtkDialog *dialog, int button, FilterDatespec *fds)
{
+ /* FIXME: this may have changed with GtkDialog??? */
if (button != 0)
return;
@@ -397,18 +404,17 @@ dialog_clicked (GnomeDialog *gd, int button, FilterDatespec *fds)
static void
button_clicked (GtkButton *button, FilterDatespec *fds)
{
- GnomeDialog *gd;
struct _FilterDatespecPrivate *p = PRIV(fds);
- GtkWidget *w, *x;
+ GtkWidget *toplevel;
+ GtkDialog *dialog;
GladeXML *gui;
gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "filter_datespec", NULL);
- w = glade_xml_get_widget (gui, "filter_datespec");
+ toplevel = glade_xml_get_widget (gui, "filter_datespec");
- gd = (GnomeDialog *) gnome_dialog_new (_("Select a time to compare against"),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
+ dialog = (GtkDialog *) gtk_dialog_new ();
+ gtk_window_set_title ((GtkWindow *) dialog, _("Select a time to compare against"));
+ gtk_dialog_add_buttons (dialog, GTK_BUTTONS_OK, GTK_BUTTONS_CANCEL, NULL);
p->notebook_type = glade_xml_get_widget (gui, "notebook_type");
p->option_type = glade_xml_get_widget (gui, "option_type");
@@ -423,11 +429,11 @@ button_clicked (GtkButton *button, FilterDatespec *fds)
g_signal_connect (GTK_OPTION_MENU (p->option_relative)->menu, "deactivate",
GTK_SIGNAL_FUNC (set_option_relative), fds);
- gtk_box_pack_start ((GtkBox *) gd->vbox, w, TRUE, TRUE, 3);
+ gtk_box_pack_start ((GtkBox *) dialog->vbox, toplevel, TRUE, TRUE, 3);
- g_signal_connect (gd, "clicked", GTK_SIGNAL_FUNC (dialog_clicked), fds);
+ g_signal_connect (dialog, "response", GTK_SIGNAL_FUNC (dialog_response), fds);
- gnome_dialog_run_and_close (gd);
+ gtk_dialog_run (dialog);
}
static GtkWidget *
diff --git a/filter/filter-file.c b/filter/filter-file.c
index 4f663efadb..aca2485a37 100644
--- a/filter/filter-file.c
+++ b/filter/filter-file.c
@@ -31,8 +31,6 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-file-entry.h>
#include "filter-file.h"
@@ -54,7 +52,7 @@ static void filter_file_init (FilterFile *ff);
static void filter_file_finalise (GObject *obj);
-static FilterElementClass *parent_class;
+static FilterElementClass *parent_class = NULL;
GType
@@ -159,9 +157,16 @@ validate (FilterElement *fe)
struct stat st;
if (!file->path) {
- dialog = gnome_ok_dialog (_("You must specify a file name"));
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", _("You must specify a file name."));
+
+ gtk_dialog_run ((GtkDialog *) dialog);
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
return FALSE;
}
@@ -169,14 +174,17 @@ validate (FilterElement *fe)
if (strcmp (file->type, "file") == 0) {
if (stat (file->path, &st) == -1 || !S_ISREG (st.st_mode)) {
- char *errmsg;
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ _("File '%s' does not exist or is not a regular file."),
+ file->path);
- errmsg = g_strdup_printf (_("File '%s' does not exist or is not a regular file."),
- file->path);
- dialog = gnome_ok_dialog (errmsg);
- g_free (errmsg);
+ gtk_dialog_run ((GtkDialog *) dialog);
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
return FALSE;
}
} else if (strcmp (file->type, "command") == 0) {
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index 7a77a0ee98..a0f43e83d6 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -26,8 +26,6 @@
#endif
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include "filter-folder.h"
#include "shell/evolution-folder-selector-button.h"
@@ -140,15 +138,20 @@ static gboolean
validate (FilterElement *fe)
{
FilterFolder *ff = (FilterFolder *) fe;
+ GtkWidget *dialog;
if (ff->uri && *ff->uri) {
return TRUE;
} else {
- GtkWidget *dialog;
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", _("You must specify a folder."));
- dialog = gnome_ok_dialog (_("You must specify a folder.\n"));
-
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gtk_dialog_run ((GtkDialog *) dialog);
return FALSE;
}
diff --git a/filter/filter-input.c b/filter/filter-input.c
index fee658d2a7..7f9f0072f9 100644
--- a/filter/filter-input.c
+++ b/filter/filter-input.c
@@ -31,8 +31,6 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include "filter-input.h"
#include "e-util/e-sexp.h"
@@ -165,19 +163,17 @@ validate (FilterElement *fe)
{
FilterInput *fi = (FilterInput *)fe;
gboolean valid = TRUE;
+ GtkWidget *dialog;
if (fi->values && !strcmp (fi->type, "regex")) {
- regex_t regexpat; /* regex patern */
- int regerr;
- char *text;
+ const char *pattern;
+ regex_t regexpat;
- text = fi->values->data;
+ pattern = fi->values->data;
- regerr = regcomp (&regexpat, text, REG_EXTENDED | REG_NEWLINE | REG_ICASE);
- if (regerr) {
- GtkWidget *dialog;
- char *regmsg, *errmsg;
+ if (regcomp (&regexpat, pattern, REG_EXTENDED | REG_NEWLINE | REG_ICASE)) {
size_t reglen;
+ char *regmsg;
/* regerror gets called twice to get the full error string
length to do proper posix error reporting */
@@ -185,15 +181,18 @@ validate (FilterElement *fe)
regmsg = g_malloc0 (reglen + 1);
regerror (regerr, &regexpat, regmsg, reglen);
- errmsg = g_strdup_printf (_("Error in regular expression '%s':\n%s"),
- text, regmsg);
- g_free (regmsg);
-
- dialog = gnome_ok_dialog (errmsg);
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ _("Error in regular expression '%s':\n%s"),
+ pattern, regmsg);
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gtk_dialog_run ((GtkDialog *) dialog);
+ g_free (regmsg);
- g_free (errmsg);
valid = FALSE;
}
diff --git a/filter/filter-label.c b/filter/filter-label.c
index a39d6cb2eb..4e04bb8d18 100644
--- a/filter/filter-label.c
+++ b/filter/filter-label.c
@@ -95,7 +95,7 @@ filter_label_init (FilterLabel *fl)
}
static void
-filter_label_finalise (GtkObject *obj)
+filter_label_finalise (GObject *obj)
{
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
diff --git a/filter/filter-part.c b/filter/filter-part.c
index ce61750161..062cc02e0c 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -507,37 +507,37 @@ filter_part_expand_code (FilterPart *ff, const char *source, GString *out)
#if 0
int main(int argc, char **argv)
{
+ GtkWidget *dialog, *w;
xmlDocPtr system;
- FilterPart *ff;
- GtkWidget *w;
- GnomeDialog *gd;
xmlNodePtr node;
+ FilterPart *ff;
GString *code;
-
- gnome_init("test", "0.0", argc, argv);
-
- system = xmlParseFile("form.xml");
- if (system==NULL) {
+
+ gnome_init ("test", "0.0", argc, argv);
+
+ system = xmlParseFile ("form.xml");
+ if (system == NULL) {
printf("i/o error\n");
return 1;
}
-
- ff = filter_part_new();
- filter_part_xml_create(ff, system->root);
-
- w = filter_part_get_widget(ff);
-
- gd = (GnomeDialog *)gnome_dialog_new(_("Test"), GNOME_STOCK_BUTTON_OK, NULL);
- gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
- gtk_box_pack_start((GtkBox *)gd->vbox, w, TRUE, TRUE, 0);
- gtk_widget_show((GtkWidget *)gd);
-
- gnome_dialog_run_and_close(gd);
-
- code = g_string_new("");
- filter_part_build_code(ff, code);
+
+ ff = filter_part_new ();
+ filter_part_xml_create (ff, system->root);
+
+ w = filter_part_get_widget (ff);
+
+ dialog = gtk_dialog_new ();
+ gtk_dialog_add_buttons ((GtkDialog *) dialog, GTK_BUTTONS_OK, NULL);
+ gtk_window_set_title ((GtkWindow *) dialog, _("Test"));
+ gtk_window_set_policy ((GtkWindow *) dialog, FALSE, TRUE, FALSE);
+ gtk_box_pack_start ((GtkBox *) dialog->vbox, w, TRUE, TRUE, 0);
+
+ gtk_dialog_run ((GtkDialog *) dialog);
+
+ code = g_string_new ("");
+ filter_part_build_code (ff, code);
printf("code is:\n%s\n", code->str);
-
+
return 0;
}
#endif
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index f1f3f5f3ae..cb4959d2fc 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -29,8 +29,6 @@
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include "filter-rule.h"
#include "filter-context.h"
@@ -206,15 +204,20 @@ filter_rule_validate (FilterRule *fr)
static int
validate (FilterRule *fr)
{
+ GtkWidget *dialog;
int valid = TRUE;
GList *parts;
if (!fr->name || !*fr->name) {
- GtkWidget *dialog;
+ /* FIXME: FilterElement should probably have a
+ GtkWidget member pointing to the value gotten with
+ ::get_widget() so that we can get the parent window
+ here. */
+ dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", _("You must name this filter."));
- dialog = gnome_ok_dialog (_("You must name this filter."));
-
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ gtk_dialog_run ((GtkDialog *) dialog);
return FALSE;
}
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index fb809ea969..16985a811f 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -28,10 +28,7 @@
/* for getenv only, remove when getenv need removed */
#include <stdlib.h>
-#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include "rule-editor.h"
@@ -66,7 +63,7 @@ struct _RuleEditorPrivate {
GtkButton *buttons[BUTTON_LAST];
};
-static GnomeDialogClass *parent_class = NULL;
+static GtkDialogClass *parent_class = NULL;
GtkType
@@ -89,7 +86,7 @@ rule_editor_get_type (void)
/* TODO: Remove when it works (or never will) */
enable_undo = getenv ("EVOLUTION_RULE_UNDO") != NULL;
- type = gtk_type_unique (gnome_dialog_get_type (), &info);
+ type = gtk_type_unique (gtk_dialog_get_type (), &info);
}
return type;
@@ -101,7 +98,7 @@ rule_editor_class_init (RuleEditorClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = (GtkObjectClass *) klass;
- parent_class = gtk_type_class (gnome_dialog_get_type ());
+ parent_class = gtk_type_class (gtk_dialog_get_type ());
gobject_class->finalize = rule_editor_finalise;
object_class->destroy = rule_editor_destroy;
@@ -619,7 +616,7 @@ editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
{
if (button != 0) {
if (enable_undo)
- rule_editor_play_undo(re);
+ rule_editor_play_undo (re);
else {
RuleEditorUndo *undo, *next;
@@ -628,7 +625,7 @@ editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
while (undo) {
next = undo->next;
g_object_unref (undo->rule);
- g_free(undo);
+ g_free (undo);
undo = next;
}
}
@@ -650,7 +647,7 @@ rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, cons
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re)->vbox), w, TRUE, TRUE, 0);
for (i = 0; i < BUTTON_LAST; i++) {
- re->priv->buttons[i] = (GtkButton *)w = glade_xml_get_widget (gui, edit_buttons[i].name);
+ re->priv->buttons[i] = (GtkButton *) w = glade_xml_get_widget (gui, edit_buttons[i].name);
g_signal_connect (w, "clicked", edit_buttons[i].func, re);
}
@@ -662,8 +659,8 @@ rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, cons
rule_editor_set_source (re, source);
if (enable_undo) {
- gnome_dialog_append_buttons (GNOME_DIALOG (re), GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
+ gtk_dialog_add_buttons ((GtkDialog *) re, GTK_BUTTONS_OK,
+ GTK_BUTTONS_CANCEL, NULL);
} else
- gnome_dialog_append_buttons (GNOME_DIALOG (re), GNOME_STOCK_BUTTON_OK, NULL);
+ gtk_dialog_add_buttons ((GtkDialog *) re, GTK_BUTTONS_OK, NULL);
}
diff --git a/filter/rule-editor.h b/filter/rule-editor.h
index df940db3e5..a184b81c16 100644
--- a/filter/rule-editor.h
+++ b/filter/rule-editor.h
@@ -24,9 +24,8 @@
#ifndef _RULE_EDITOR_H
#define _RULE_EDITOR_H
-#include <gtk/gtklist.h>
+#include <gtk/gtk.h>
#include <glade/glade.h>
-#include <libgnomeui/gnome-dialog.h>
#include "rule-context.h"
#include "filter-rule.h"
@@ -43,7 +42,7 @@ typedef struct _RuleEditorClass RuleEditorClass;
typedef struct _RuleEditorUndo RuleEditorUndo;
struct _RuleEditor {
- GnomeDialog parent_object;
+ GtkDialog parent_object;
GtkList *list;
RuleContext *context;
@@ -61,7 +60,7 @@ struct _RuleEditor {
};
struct _RuleEditorClass {
- GnomeDialogClass parent_class;
+ GtkDialogClass parent_class;
/* virtual methods */
void (*set_sensitive) (RuleEditor *);