aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-12 07:06:00 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-12 07:06:00 +0800
commita1a10f1ebef52168ec01c99f9f952cf13c099d54 (patch)
treed45b35a49fd99969e3dd145525229084ffba4a70 /addressbook/gui
parente1e75fa38d0aac27008cf089cf99257cb83964ae (diff)
downloadgsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.gz
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.bz2
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.lz
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.xz
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.tar.zst
gsoc2013-evolution-a1a10f1ebef52168ec01c99f9f952cf13c099d54.zip
change around a little, still ifdefed though.
2002-11-11 Chris Toshok <toshok@ximian.com> * gui/contact-editor/e-contact-editor.c (_arrow_pressed): change around a little, still ifdefed though. * gui/contact-editor/e-contact-save-as.c (file_exists): same. (save_it): deal with the GtkDialog response ids. * gui/contact-editor/e-contact-editor.c (e_contact_editor_confirm_delete): just build the dialog here (using gtk_message_dialog*). * gui/contact-editor/Makefile.am (glade_DATA): remove file-exists.glade and e-contact-editor-confirm-delete.glade. svn path=/trunk/; revision=18712
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/Makefile.am4
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade69
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c58
-rw-r--r--addressbook/gui/contact-editor/e-contact-save-as.c50
-rw-r--r--addressbook/gui/contact-editor/file-exists.glade80
5 files changed, 57 insertions, 204 deletions
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am
index fb61b1a97b..dbbd0350a7 100644
--- a/addressbook/gui/contact-editor/Makefile.am
+++ b/addressbook/gui/contact-editor/Makefile.am
@@ -55,9 +55,7 @@ gladedir = $(datadir)/evolution/glade
glade_DATA = \
contact-editor.glade \
fulladdr.glade \
- fullname.glade \
- file-exists.glade \
- e-contact-editor-confirm-delete.glade
+ fullname.glade
BUILT_SOURCES = $(MARSHAL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
diff --git a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade b/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade
deleted file mode 100644
index 66921f4ccc..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <requires lib="gnome" />
-
- <widget class="GnomeMessageBox" id="confirm-dialog">
- <property name="message">Are you sure you want
-to delete this contact?</property>
- <property name="title" translatable="yes">Delete Contact?</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">no</property>
- <property name="auto_close">yes</property>
- <property name="hide_on_close">no</property>
- <property name="visible">yes</property>
- <property name="message_box_type">question</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button2">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">4</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
-</glade-interface>
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index c78715008c..c7298819f1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1041,12 +1041,12 @@ prompt_to_save_changes (EContactEditor *editor)
return TRUE;
switch (e_addressbook_prompt_save_dialog (GTK_WINDOW(editor->app))) {
- case 0: /* Save */
+ case GTK_RESPONSE_YES:
save_card (editor, FALSE);
return TRUE;
- case 1: /* Discard */
+ case GTK_RESPONSE_NO:
return TRUE;
- case 2: /* Cancel */
+ case GTK_RESPONSE_CANCEL:
default:
return FALSE;
}
@@ -1123,25 +1123,34 @@ file_send_to_cb (GtkWidget *widget, gpointer data)
}
gboolean
-e_contact_editor_confirm_delete(GtkWindow *parent)
-{
- GtkDialog *dialog;
- GladeXML *gui;
- int result;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL, NULL);
-
- dialog = GTK_DIALOG(glade_xml_get_widget(gui, "confirm-dialog"));
+e_contact_editor_confirm_delete (GtkWindow *parent)
+{
+ GtkWidget *dialog;
+ gint result;
+
+ dialog = gtk_message_dialog_new (parent,
+ 0,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+#if notyet
+ /* XXX we really need to handle the plural case here.. */
+ (plural
+ ? _("Are you sure you want\n"
+ "to delete these contacts?"))
+#endif
+ _("Are you sure you want\n"
+ "to delete this contact?"));
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
- result = gtk_dialog_run(dialog);
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ _("Delete"), GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
- gtk_widget_hide (GTK_WIDGET (dialog));
+ result = gtk_dialog_run(GTK_DIALOG (dialog));
- g_object_unref(gui);
+ gtk_widget_destroy (dialog);
- return !result;
+ return (result == GTK_RESPONSE_ACCEPT);
}
static void
@@ -1732,8 +1741,8 @@ _popup_position(GtkMenu *menu,
GtkRequisition request;
int mh, mw;
gdk_window_get_origin (button->window, x, y);
- *x += button->allocation.width;
- *y += button->allocation.height;
+ *x += button->allocation.x;
+ *y += button->allocation.y;
gtk_widget_size_request(GTK_WIDGET(menu), &request);
@@ -1754,15 +1763,18 @@ _popup_position(GtkMenu *menu,
*y = gdk_screen_height () - mh;
/* XXX? */
- *push_in = FALSE;
+ *push_in = TRUE;
}
static gint
_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title)
{
gint menu_item;
-#if 0
- g_signal_emit_by_name(widget, "button_press_event");
+
+#if PENDING_PORT_WORK
+ g_signal_handlers_block_matched (widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor);
+ g_signal_emit_by_name (widget, "button_press_event", NULL, NULL, NULL);
+ g_signal_handlers_unblock_matched (widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, editor);
#endif
gtk_widget_realize(popup);
menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor, widget);
diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c
index d044332be1..73651b9f21 100644
--- a/addressbook/gui/contact-editor/e-contact-save-as.c
+++ b/addressbook/gui/contact-editor/e-contact-save-as.c
@@ -34,7 +34,7 @@
#include <string.h>
#include <libgnomeui/gnome-messagebox.h>
-static int file_exists(GtkFileSelection *filesel, const char *filename);
+static gint file_exists(GtkFileSelection *filesel, const char *filename);
typedef struct {
GtkFileSelection *filesel;
@@ -54,10 +54,10 @@ save_it(GtkWidget *widget, SaveAsInfo *info)
if (error == EEXIST) {
response = file_exists(info->filesel, filename);
switch (response) {
- case 0 : /* Overwrite */
+ case GTK_RESPONSE_ACCEPT : /* Overwrite */
e_write_file(filename, info->vcard, O_WRONLY | O_CREAT | O_TRUNC);
break;
- case 1 : /* cancel */
+ case GTK_RESPONSE_REJECT : /* cancel */
return;
}
} else if (error != 0) {
@@ -204,32 +204,24 @@ e_contact_list_save_as(char *title, GList *list, GtkWindow *parent_window)
gtk_widget_show(GTK_WIDGET(filesel));
}
-static int
+static gint
file_exists(GtkFileSelection *filesel, const char *filename)
{
- GtkDialog *dialog = NULL;
- GtkWidget *label;
- GladeXML *gui = NULL;
- int result = 0;
- char *string;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/file-exists.glade", NULL, NULL);
- dialog = GTK_DIALOG(glade_xml_get_widget(gui, "dialog-exists"));
-
- label = glade_xml_get_widget (gui, "label-exists");
- if (GTK_IS_LABEL (label)) {
- string = g_strdup_printf (_("%s already exists\nDo you want to overwrite it?"), filename);
- gtk_label_set_text (GTK_LABEL (label), string);
- g_free (string);
- }
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(filesel));
-
- gtk_widget_show (GTK_WIDGET (dialog));
- result = gtk_dialog_run(dialog);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- g_free(gui);
-
- return result;
+ GtkWidget *dialog;
+ gint response;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (filesel),
+ 0,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_NONE,
+ _("%s already exists\nDo you want to overwrite it?"), filename);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ _("Overwrite"), GTK_RESPONSE_ACCEPT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
+ NULL);
+
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ return response;
}
diff --git a/addressbook/gui/contact-editor/file-exists.glade b/addressbook/gui/contact-editor/file-exists.glade
deleted file mode 100644
index aa886f1f80..0000000000
--- a/addressbook/gui/contact-editor/file-exists.glade
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <widget class="GtkDialog" id="dialog-exists">
- <property name="visible">no</property>
- <property name="title" translatable="yes">Confirm Overwrite</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">no</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Overwrite</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="can_default">yes</property>
- <property name="has_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-exists">
- <property name="label" translatable="yes">Don't bother translating this string. It's not used.</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">4</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
-</glade-interface>