aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-config.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-12-19 10:24:24 +0800
committerChris Toshok <toshok@src.gnome.org>2002-12-19 10:24:24 +0800
commit82a04fbcb419e35c7132ade04c4a688b14c1f8dd (patch)
tree392cce48da9badb13bf5e58946ad35a32a00e312 /widgets/table/e-table-config.c
parentbe8b72f96374ec259a161750a3d3ed0cd48cefbc (diff)
downloadgsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar.gz
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar.bz2
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar.lz
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar.xz
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.tar.zst
gsoc2013-evolution-82a04fbcb419e35c7132ade04c4a688b14c1f8dd.zip
pass NULL for parent_window for e_table_config_new.
2002-12-18 Chris Toshok <toshok@ximian.com> * e-table-header-item.c (ethi_popup_customize_view): pass NULL for parent_window for e_table_config_new. * e-table-config.glade, e-table-config-no-group.glade: switch from GnomePropertyBox to GtkDialog, remove the extra notebook widget from the heirarchy, and set all the subdialogs modal. * e-table-config.h: add parent_window arg to e_table_config_{new,construct}. * e-table-config.c (config_dialog_changed): new function, not really needed yet since the apply/ok buttons are never insensitive. (config_get_property): handle the "state" read-only property. (config_class_init): put back in the "state" property that was deleted during the merge from the gal-2 branch (it looks like). (do_sort_and_group_config_dialog): set the sort/group dialog transient for the e-table-config dialog, and gnome_property_box_changed -> config_dialog_changed. (do_fields_config_dialog): same, but with the fields dialog. (dialog_response): response handler for the e-table-config dialog. (setup_gui): remote the hide button/notebook code, since neither of those widgets exist anymore in this dialog, and remove the "apply" signal and connect to "response", since we're a GtkDialog dialog instead of a GnomePropertyBox. (e_table_config_construct): take a parent_window arg, and set_transient_for if it's non-NULL. (e_table_config_new): take parent_window arg and pass to construct. svn path=/trunk/; revision=19165
Diffstat (limited to 'widgets/table/e-table-config.c')
-rw-r--r--widgets/table/e-table-config.c91
1 files changed, 68 insertions, 23 deletions
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
index 4894fdb6d8..76d11470d3 100644
--- a/widgets/table/e-table-config.c
+++ b/widgets/table/e-table-config.c
@@ -36,7 +36,6 @@
#include <gtk/gtkdialog.h>
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
-#include <gtk/gtknotebook.h>
#include <gtk/gtktogglebutton.h>
#include <libgnomeui/gnome-propertybox.h>
#include <glade/glade.h>
@@ -56,6 +55,11 @@ enum {
LAST_SIGNAL
};
+enum {
+ PROP_0,
+ PROP_STATE,
+};
+
static guint e_table_config_signals [LAST_SIGNAL] = { 0, };
static void
@@ -98,6 +102,33 @@ e_table_config_changed (ETableConfig *config, ETableState *state)
}
static void
+config_dialog_changed (ETableConfig *config)
+{
+ /* enable the apply/ok buttons */
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
+ GTK_RESPONSE_APPLY, TRUE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
+ GTK_RESPONSE_OK, TRUE);
+}
+
+static void
+config_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ ETableConfig *config = E_TABLE_CONFIG (object);
+
+ switch (prop_id) {
+ case PROP_STATE:
+ g_value_set_object (value, config->state);
+ break;
+ default:
+ break;
+ }
+}
+
+static void
config_class_init (GObjectClass *object_class)
{
ETableConfigClass *klass = E_TABLE_CONFIG_CLASS(object_class);
@@ -107,6 +138,7 @@ config_class_init (GObjectClass *object_class)
klass->changed = NULL;
object_class->finalize = config_finalize;
+ object_class->get_property = config_get_property;
e_table_config_signals [CHANGED] =
g_signal_new ("changed",
@@ -117,6 +149,13 @@ config_class_init (GObjectClass *object_class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ g_object_class_install_property (object_class, PROP_STATE,
+ g_param_spec_object ("state",
+ _("State"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TABLE_STATE_TYPE,
+ G_PARAM_READABLE));
+
glade_gnome_init ();
}
@@ -386,6 +425,8 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
else
dialog = GTK_DIALOG (config->dialog_group_by);
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (config->dialog_toplevel));
+
do {
response = gtk_dialog_run (dialog);
switch (response){
@@ -405,8 +446,7 @@ do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
config->state = config->temp_state;
config->temp_state = 0;
running = 0;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
+ config_dialog_changed (config);
break;
case GTK_RESPONSE_CANCEL:
@@ -434,6 +474,9 @@ do_fields_config_dialog (ETableConfig *config)
setup_fields (config);
+ gtk_window_set_transient_for (GTK_WINDOW (config->dialog_show_fields),
+ GTK_WINDOW (config->dialog_toplevel));
+
do {
response = gtk_dialog_run (GTK_DIALOG(config->dialog_show_fields));
switch (response){
@@ -442,8 +485,7 @@ do_fields_config_dialog (ETableConfig *config)
config->state = config->temp_state;
config->temp_state = 0;
running = 0;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
+ config_dialog_changed (config);
break;
/* CANCEL */
@@ -543,13 +585,18 @@ dialog_destroyed (gpointer data, GObject *where_object_was)
}
static void
-dialog_apply (GnomePropertyBox *pbox, gint page_num, ETableConfig *config)
+dialog_response (GtkWidget *dialog, int response_id, ETableConfig *config)
{
- if (page_num != -1)
- return;
+ if (response_id == GTK_RESPONSE_APPLY
+ || response_id == GTK_RESPONSE_OK) {
+ e_table_config_changed (config, config->state);
+ }
- e_table_config_changed (config, config->state);
-}
+ if (response_id == GTK_RESPONSE_CANCEL
+ || response_id == GTK_RESPONSE_OK) {
+ gtk_widget_destroy (dialog);
+ }
+}
/*
* Invoked by the Glade auto-connect code
@@ -1007,13 +1054,6 @@ setup_gui (ETableConfig *config)
if (config->header)
gtk_window_set_title (GTK_WINDOW (config->dialog_toplevel), config->header);
- gtk_widget_hide (GNOME_PROPERTY_BOX(config->dialog_toplevel)->help_button);
-
- gtk_notebook_set_show_tabs (
- GTK_NOTEBOOK (GNOME_PROPERTY_BOX (
- config->dialog_toplevel)->notebook),
- FALSE);
-
config->dialog_show_fields = glade_xml_get_widget (
gui, "dialog-show-fields");
config->dialog_group_by = glade_xml_get_widget (
@@ -1039,9 +1079,8 @@ setup_gui (ETableConfig *config)
g_object_weak_ref (G_OBJECT (config->dialog_toplevel),
dialog_destroyed, config);
- g_signal_connect (
- G_OBJECT (config->dialog_toplevel), "apply",
- G_CALLBACK (dialog_apply), config);
+ g_signal_connect (config->dialog_toplevel, "response",
+ G_CALLBACK (dialog_response), config);
g_object_unref (gui);
}
@@ -1056,7 +1095,8 @@ ETableConfig *
e_table_config_construct (ETableConfig *config,
const char *header,
ETableSpecification *spec,
- ETableState *state)
+ ETableState *state,
+ GtkWindow *parent_window)
{
ETableColumnSpecification **column;
@@ -1088,6 +1128,10 @@ e_table_config_construct (ETableConfig *config,
setup_gui (config);
+ if (parent_window)
+ gtk_window_set_transient_for (GTK_WINDOW (config->dialog_toplevel),
+ parent_window);
+
config_sort_info_update (config);
config_group_info_update (config);
config_fields_info_update (config);
@@ -1108,11 +1152,12 @@ e_table_config_construct (ETableConfig *config,
ETableConfig *
e_table_config_new (const char *header,
ETableSpecification *spec,
- ETableState *state)
+ ETableState *state,
+ GtkWindow *parent_window)
{
ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);
- if (e_table_config_construct (config, header, spec, state) == NULL){
+ if (e_table_config_construct (config, header, spec, state, parent_window) == NULL){
g_object_unref (config);
return NULL;
}