/*
- * (GLABELS) Label and Business Card Creation program for GNOME
+ * object-editor-data-page.c
+ * Copyright (C) 2003-2009 Jim Evins <evins@snaught.com>.
*
- * object-editor.c: object properties editor module
+ * This file is part of gLabels.
*
- * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
+ * gLabels is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * gLabels is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with gLabels. If not, see <http://www.gnu.org/licenses/>.
*/
+
#include <config.h>
-#include <gnome.h>
+#include "object-editor.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <string.h>
#include <math.h>
-#include "object-editor.h"
#include "prefs.h"
+#include "combo-util.h"
+#include "builder-util.h"
#include "object-editor-private.h"
#include "debug.h"
+
/*===========================================*/
/* Private macros */
/*===========================================*/
+
/*===========================================*/
/* Private data types */
/*===========================================*/
+
/*===========================================*/
/* Private globals */
/*===========================================*/
+
/*===========================================*/
/* Local function prototypes */
/*===========================================*/
static void data_radio_toggled_cb (glObjectEditor *editor);
-\f
/*--------------------------------------------------------------------------*/
/* PRIVATE. Prepare data page. */
/*--------------------------------------------------------------------------*/
void
gl_object_editor_prepare_data_page (glObjectEditor *editor)
{
- GdkColor *gdk_color;
-
gl_debug (DEBUG_EDITOR, "START");
/* Extract widgets from XML tree. */
- editor->priv->data_page_vbox = glade_xml_get_widget (editor->priv->gui,
- "data_page_vbox");
- editor->priv->data_literal_radio = glade_xml_get_widget (editor->priv->gui,
- "data_literal_radio");
- editor->priv->data_key_radio = glade_xml_get_widget (editor->priv->gui,
- "data_key_radio");
- editor->priv->data_text_entry = glade_xml_get_widget (editor->priv->gui,
- "data_text_entry");
- editor->priv->data_key_combo = glade_xml_get_widget (editor->priv->gui,
- "data_key_combo");
- editor->priv->data_key_entry = glade_xml_get_widget (editor->priv->gui,
- "data_key_entry");
+ gl_builder_util_get_widgets (editor->priv->builder,
+ "data_page_vbox", &editor->priv->data_page_vbox,
+ "data_literal_radio", &editor->priv->data_literal_radio,
+ "data_key_radio", &editor->priv->data_key_radio,
+ "data_text_entry", &editor->priv->data_text_entry,
+ "data_key_combo", &editor->priv->data_key_combo,
+ NULL);
+
+ gl_combo_util_add_text_model ( GTK_COMBO_BOX(editor->priv->data_key_combo));
/* Un-hide */
gtk_widget_show_all (editor->priv->data_page_vbox);
"changed",
G_CALLBACK (gl_object_editor_changed_cb),
G_OBJECT (editor));
- g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_entry),
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_combo),
"changed",
G_CALLBACK (gl_object_editor_changed_cb),
G_OBJECT (editor));
gl_debug (DEBUG_EDITOR, "END");
}
+
/*--------------------------------------------------------------------------*/
/* PRIVATE. data radio callback. */
/*--------------------------------------------------------------------------*/
static void
data_radio_toggled_cb (glObjectEditor *editor)
{
+ if (editor->priv->stop_signals) return;
+
gl_debug (DEBUG_WDGT, "START");
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
gl_debug (DEBUG_WDGT, "END");
}
+
/*****************************************************************************/
/* Set data. */
/*****************************************************************************/
gl_debug (DEBUG_EDITOR, "START");
- g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_text_entry),
- G_CALLBACK (gl_object_editor_changed_cb),
- editor);
- g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_key_entry),
- G_CALLBACK (gl_object_editor_changed_cb),
- editor);
+ editor->priv->stop_signals = TRUE;
gtk_widget_set_sensitive (editor->priv->data_key_radio, merge_flag);
gtk_widget_set_sensitive (editor->priv->data_digits_spin,
!editor->priv->data_format_fixed_flag);
- gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_key_entry), 0, -1);
- pos = 0;
- gtk_editable_insert_text (GTK_EDITABLE (editor->priv->data_key_entry),
- text_node->data,
- strlen (text_node->data),
- &pos);
+
+ gl_combo_util_set_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo),
+ text_node->data);
}
- g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_text_entry),
- G_CALLBACK (gl_object_editor_changed_cb),
- editor);
- g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_key_entry),
- G_CALLBACK (gl_object_editor_changed_cb),
- editor);
+ editor->priv->stop_signals = FALSE;
gl_debug (DEBUG_EDITOR, "END");
}
+
/*****************************************************************************/
/* Query data. */
/*****************************************************************************/
} else {
text_node->field_flag = TRUE;
text_node->data =
- gtk_editable_get_chars (GTK_EDITABLE (editor->priv->data_key_entry),
- 0, -1);
+ gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->data_key_combo));
}
gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s",
return text_node;
}
+
+
+
+/*
+ * Local Variables: -- emacs
+ * mode: C -- emacs
+ * c-basic-offset: 8 -- emacs
+ * tab-width: 8 -- emacs
+ * indent-tabs-mode: nil -- emacs
+ * End: -- emacs
+ */