aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-27 10:10:21 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-27 10:10:21 +0800
commit83a54e15a95b22f91b5ef68a2687a7af9f9d1b43 (patch)
treeb4eba3bbdfaa138636b8c58514f6b36577eba0ad /addressbook
parent1c0c2cc2f45e462abcaf2fd9dc2e5542c722ea49 (diff)
downloadgsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar.gz
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar.bz2
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar.lz
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar.xz
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.tar.zst
gsoc2013-evolution-83a54e15a95b22f91b5ef68a2687a7af9f9d1b43.zip
use new schema for completion/uris. (uris_listener): same.
2002-11-26 Chris Toshok <toshok@ximian.com> * gui/component/select-names/e-select-names-manager.c (read_completion_books_from_db): use new schema for completion/uris. (uris_listener): same. * gui/component/select-names/e-select-names.h: Convert to GtkDialog from GnomeDialog. * gui/component/select-names/e-select-names.c: Convert to GtkDialog from GnomeDialog. (folder_selected): use new schema for last_used_uri. (e_select_names_init): same. (e_select_names_set_default): use pango markup to set bold/not-bold. (e_select_names_add_section): don't bother creating an EEntry, we can use pango and a normal label. This also keeps us from wrapping "contacts ->" at the '-'. * gui/component/apps_evolution_addressbook.schemas: new file. * gui/component/Makefile.am: add the schema stuff. svn path=/trunk/; revision=18939
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog24
-rw-r--r--addressbook/gui/component/Makefile.am12
-rw-r--r--addressbook/gui/component/apps_evolution_addressbook.schemas31
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c22
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c121
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h7
6 files changed, 140 insertions, 77 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 512b40c531..4aea8b107a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,27 @@
+2002-11-26 Chris Toshok <toshok@ximian.com>
+
+ * gui/component/select-names/e-select-names-manager.c
+ (read_completion_books_from_db): use new schema for
+ completion/uris.
+ (uris_listener): same.
+
+ * gui/component/select-names/e-select-names.h: Convert to
+ GtkDialog from GnomeDialog.
+
+ * gui/component/select-names/e-select-names.c: Convert to
+ GtkDialog from GnomeDialog.
+ (folder_selected): use new schema for last_used_uri.
+ (e_select_names_init): same.
+ (e_select_names_set_default): use pango markup to set
+ bold/not-bold.
+ (e_select_names_add_section): don't bother creating an EEntry, we
+ can use pango and a normal label. This also keeps us from
+ wrapping "contacts ->" at the '-'.
+
+ * gui/component/apps_evolution_addressbook.schemas: new file.
+
+ * gui/component/Makefile.am: add the schema stuff.
+
2002-11-24 Chris Toshok <toshok@ximian.com>
* gui/component/addressbook-config.c (query_for_supported_bases):
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 2dc9972641..b5ec044cd5 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -68,6 +68,18 @@ evolution_addressbook_LDADD = \
# not done yet:
# $(top_builddir)/filter/libfilter.la
+# GConf schemas
+
+schemadir = $(GCONF_SCHEMA_FILE_DIR)
+schema_DATA = apps_evolution_addressbook.schemas
+
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schema_DATA) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
+ done \
+ fi
+
server_in_files = GNOME_Evolution_Addressbook.server.in.in
serverdir = $(libdir)/bonobo/servers
diff --git a/addressbook/gui/component/apps_evolution_addressbook.schemas b/addressbook/gui/component/apps_evolution_addressbook.schemas
new file mode 100644
index 0000000000..f54d0828ce
--- /dev/null
+++ b/addressbook/gui/component/apps_evolution_addressbook.schemas
@@ -0,0 +1,31 @@
+<gconfschemafile>
+ <schemalist>
+
+ <!-- Completion uris -->
+
+ <schema>
+ <key>/schemas/apps/evolution/addressbook/completion/uris</key>
+ <applyto>/apps/evolution/addressbook/completion/uris</applyto>
+ <owner>evolution-addressbook</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>EFolderList xml for the list of completion uris</short>
+ </locale>
+ </schema>
+
+ <!-- Select names last used uri -->
+
+ <schema>
+ <key>/schemas/apps/evolution/addressbook/select_names/last_used_uri</key>
+ <applyto>/apps/evolution/addressbook/select_names/last_used_uri</applyto>
+ <owner>evolution-addressbook</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>URI for the folder last used in the select names dialog</short>
+ </locale>
+ </schema>
+
+ </schemalist>
+</gconfschemafile> \ No newline at end of file
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index 80a1cffbda..c994bc1c3c 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -411,7 +411,7 @@ read_completion_books_from_db (ESelectNamesManager *manager, EConfigListener *db
{
char *val;
- val = e_config_listener_get_string (db, "/apps/Evolution/Addressbook/Completion/uris");
+ val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris");
if (val) {
g_free (manager->cached_folder_list);
@@ -428,10 +428,10 @@ uris_listener (EConfigListener *db, const char *key,
char *val;
/* return if it's not the key we're interested in */
- if (!strcmp (key, "/apps/Evolution/Addressbook/Completion/uris"))
+ if (!strcmp (key, "/apps/evolution/addressbook/completion/uris"))
return;
- val = e_config_listener_get_string (db, "/apps/Evolution/Addressbook/Completion/uris");
+ val = e_config_listener_get_string (db, "/apps/evolution/addressbook/completion/uris");
if (val) {
if (!manager->cached_folder_list || strcmp (val, manager->cached_folder_list)) {
@@ -556,17 +556,17 @@ e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *i
}
static void
-e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *manager)
+e_select_names_response(ESelectNames *dialog, gint response_id, ESelectNamesManager *manager)
{
- gnome_dialog_close(GNOME_DIALOG(dialog));
+ gtk_widget_destroy (GTK_DIALOG (dialog));
- switch(button) {
- case 0:
+ switch(response_id) {
+ case GTK_RESPONSE_OK:
e_select_names_manager_discard_saved_models (manager);
g_signal_emit (manager, e_select_names_manager_signals[OK], 0);
break;
- case 1:
+ case GTK_RESPONSE_CANCEL:
e_select_names_manager_revert_to_saved_models (manager);
g_signal_emit (manager, e_select_names_manager_signals[CANCEL], 0);
break;
@@ -608,9 +608,9 @@ e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
e_select_names_set_default (manager->names, id);
g_signal_connect(manager->names,
- "clicked",
- G_CALLBACK(e_select_names_clicked),
- manager);
+ "response",
+ G_CALLBACK(e_select_names_response),
+ manager);
g_object_weak_ref (G_OBJECT (manager->names), clear_widget, &manager->names);
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 0e666a62d3..54186ee16b 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -22,8 +22,6 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-without.h>
@@ -56,8 +54,8 @@ static void update_query (GtkWidget *widget, ESelectNames *e_select_names);
extern EvolutionShellClient *global_shell_client;
-static GnomeDialogClass *parent_class = NULL;
-#define PARENT_TYPE gnome_dialog_get_type()
+static GtkDialogClass *parent_class = NULL;
+#define PARENT_TYPE gtk_dialog_get_type()
/* The arguments we take */
enum {
@@ -336,7 +334,7 @@ folder_selected (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *
addressbook_model_set_uri(e_select_names, e_select_names->model, folder->physicalUri);
e_config_listener_set_string (e_book_get_config_database(),
- "/Addressbook/select_names_uri", folder->physicalUri);
+ "/apps/evolution/addressbook/select_names/last_used_uri", folder->physicalUri);
}
static void
@@ -390,7 +388,7 @@ status_message (EAddressbookModel *model, const gchar *message, ESelectNames *e_
}
static void
-categories_changed (GtkWidget *widget, gint value, ESelectNames *e_select_names)
+categories_changed (GtkWidget *widget, ESelectNames *e_select_names)
{
update_query (widget, e_select_names);
}
@@ -442,7 +440,6 @@ e_select_names_create_categories (gchar *name,
gchar *string1, gchar *string2,
gint int1, gint int2)
{
-#ifdef PENDING_PORT_WORK
ECategoriesMasterList *ecml;
GtkWidget *option_menu;
@@ -451,9 +448,6 @@ e_select_names_create_categories (gchar *name,
g_object_unref (ecml);
return option_menu;
-#else
- return gtk_label_new ("e_select_names_create_categories\nneeds work");
-#endif
}
static void
@@ -488,14 +482,16 @@ e_select_names_init (ESelectNames *e_select_names)
}
gtk_widget_ref(widget);
gtk_widget_unparent(widget);
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0);
gtk_widget_unref(widget);
- gnome_dialog_append_buttons(GNOME_DIALOG(e_select_names),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
- gnome_dialog_set_default(GNOME_DIALOG(e_select_names), 0);
+ gtk_dialog_add_buttons (GTK_DIALOG (e_select_names),
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (e_select_names),
+ GTK_RESPONSE_OK);
gtk_window_set_title(GTK_WINDOW(e_select_names), _("Select Contacts from Addressbook"));
gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE);
@@ -511,7 +507,7 @@ e_select_names_init (ESelectNames *e_select_names)
e_select_names->status_message = NULL;
if (e_select_names->status_message) {
g_signal_connect (e_select_names->model, "status_message",
- G_CALLBACK (status_message), e_select_names);
+ G_CALLBACK (status_message), e_select_names);
g_object_weak_ref (G_OBJECT (e_select_names->status_message), clear_widget, &e_select_names->status_message);
}
@@ -520,33 +516,36 @@ e_select_names_init (ESelectNames *e_select_names)
e_select_names->categories = NULL;
if (e_select_names->categories) {
g_signal_connect(e_select_names->categories, "changed",
- G_CALLBACK(categories_changed), e_select_names);
+ G_CALLBACK(categories_changed), e_select_names);
g_object_weak_ref (G_OBJECT (e_select_names->categories), clear_widget, &e_select_names->categories);
}
+ gtk_widget_show (e_select_names->categories);
e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select");
if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry))
e_select_names->select_entry = NULL;
if (e_select_names->select_entry) {
g_signal_connect(e_select_names->select_entry, "changed",
- G_CALLBACK(select_entry_changed), e_select_names);
+ G_CALLBACK(select_entry_changed), e_select_names);
g_signal_connect(e_select_names->select_entry, "activate",
- G_CALLBACK(update_query), e_select_names);
+ G_CALLBACK(update_query), e_select_names);
g_object_weak_ref (G_OBJECT (e_select_names->select_entry), clear_widget, &e_select_names->select_entry);
}
button = glade_xml_get_widget (gui, "button-find");
if (button && GTK_IS_BUTTON (button))
g_signal_connect(button, "clicked",
- G_CALLBACK(update_query), e_select_names);
+ G_CALLBACK(update_query), e_select_names);
- contacts_uri = e_config_listener_get_string_with_default (db, "/Addressbook/select_names_uri", NULL, NULL);
+ contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/addressbook/select_names/last_used_uri", NULL, NULL);
if (!contacts_uri) {
- contacts_uri = e_config_listener_get_string_with_default (db, "/DefaultFolders/contacts_uri",
+ contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/shell/default_folders/contacts_uri",
NULL, NULL);
}
- if (!contacts_uri) {
- filename = gnome_util_prepend_user_home("evolution/local/Contacts");
+ if (!contacts_uri || !contacts_uri[0]) {
+ if (contacts_uri)
+ g_free (contacts_uri);
+ filename = g_build_filename (g_get_home_dir(), "evolution/local/Contacts", NULL);
contacts_uri = g_strdup_printf("file://%s", filename);
g_free (filename);
}
@@ -559,12 +558,13 @@ e_select_names_init (ESelectNames *e_select_names)
selector_types);
if (button && EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (button))
g_signal_connect(button, "selected",
- G_CALLBACK(folder_selected), e_select_names);
+ G_CALLBACK(folder_selected), e_select_names);
+ gtk_widget_show (button);
g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "double_click",
- G_CALLBACK (add_address), e_select_names);
+ G_CALLBACK (add_address), e_select_names);
g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "selection_change",
- G_CALLBACK (selection_change), e_select_names);
+ G_CALLBACK (selection_change), e_select_names);
selection_change (e_table_scrolled_get_table (e_select_names->table), e_select_names);
addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri);
@@ -707,11 +707,12 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
{
ESelectNamesChild *child;
GtkWidget *button;
- GtkWidget *alignment;
GtkWidget *label;
+ GtkWidget *alignment;
GtkTable *table;
char *label_text;
ETable *etable;
+ PangoLayout *layout;
GtkWidget *sw;
GtkWidget *recipient_table;
@@ -737,25 +738,15 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
alignment = gtk_alignment_new(0, 0, 1, 0);
- button = gtk_button_new ();
+ label_text = g_strconcat (child->title, " ->", NULL);
- label = e_entry_new ();
- g_object_set(label,
- "draw_background", FALSE,
- "draw_borders", FALSE,
- "draw_button", TRUE,
- "editable", FALSE,
- "text", "",
- "use_ellipsis", FALSE,
- "justification", GTK_JUSTIFY_CENTER,
- NULL);
+ label = gtk_label_new ("");
+
+ gtk_label_set_markup (GTK_LABEL(label), label_text);
- label_text = g_strconcat (child->title, " ->", NULL);
- g_object_set (label,
- "text", label_text,
- "emulate_label_resize", TRUE,
- NULL);
g_free (label_text);
+
+ button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), label);
child->label = label;
child->button = button;
@@ -763,7 +754,7 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
gtk_container_add(GTK_CONTAINER(alignment), button);
gtk_widget_show_all(alignment);
g_signal_connect(button, "clicked",
- G_CALLBACK(button_clicked), child);
+ G_CALLBACK(button_clicked), child);
gtk_table_attach(table, alignment,
0, 1,
e_select_names->child_count,
@@ -782,24 +773,24 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
NULL);
g_signal_connect (recipient_table,
- "popup",
- G_CALLBACK (section_right_click_cb),
- child);
+ "popup",
+ G_CALLBACK (section_right_click_cb),
+ child);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table);
#if 0
g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "right_click",
- G_CALLBACK(section_right_click_cb), child);
+ G_CALLBACK(section_right_click_cb), child);
g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "double_click",
- G_CALLBACK(remove_address), child);
+ G_CALLBACK(remove_address), child);
#endif
g_signal_connect (child->source,
- "changed",
- G_CALLBACK (sync_table_and_models),
- e_select_names);
+ "changed",
+ G_CALLBACK (sync_table_and_models),
+ e_select_names);
gtk_widget_show_all (sw);
@@ -871,10 +862,12 @@ e_select_names_set_default (ESelectNames *e_select_names,
if (e_select_names->def) {
child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child)
- g_object_set (E_ENTRY (child->label)->item,
- "bold", FALSE,
- NULL);
+ if (child) {
+ GtkWidget *label = child->label;
+
+ /* set the previous default to non-bold */
+ gtk_label_set_markup (GTK_LABEL (label), child->title);
+ }
}
g_free(e_select_names->def);
@@ -882,9 +875,13 @@ e_select_names_set_default (ESelectNames *e_select_names,
if (e_select_names->def) {
child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child)
- g_object_set (E_ENTRY (child->label)->item,
- "bold", TRUE,
- NULL);
+ if (child) {
+ GtkWidget *label = child->label;
+ char *markup = g_strconcat ("<b>", child->title, "</b>", NULL);
+
+ /* set the new default to bold */
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free (markup);
+ }
}
}
diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h
index d61cf0b388..bbed1d77ee 100644
--- a/addressbook/gui/component/select-names/e-select-names.h
+++ b/addressbook/gui/component/select-names/e-select-names.h
@@ -22,8 +22,7 @@
#include <glib.h>
#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-dialog.h>
+#include <gtk/gtkdialog.h>
#include <glade/glade.h>
#include <gal/e-table/e-table.h>
#include <gal/e-table/e-table-scrolled.h>
@@ -58,7 +57,7 @@ typedef struct _ESelectNamesFolder ESelectNamesFolder;
struct _ESelectNames
{
- GnomeDialog parent;
+ GtkDialog parent;
/* item specific fields */
GladeXML *gui;
@@ -78,7 +77,7 @@ struct _ESelectNames
struct _ESelectNamesClass
{
- GnomeDialogClass parent_class;
+ GtkDialogClass parent_class;
};