aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2009-10-18 10:23:50 +0000
committerAnders Broman <anders.broman@ericsson.com>2009-10-18 10:23:50 +0000
commit977e880afb62fe1d87dd2f8a1d4c54f0f8177a5b (patch)
tree8c4ce2d8a9c20381786126761e45cc5cf322c6de /gtk
parentea9fca6f4b6485dfb216b6ffba7737640338078e (diff)
Use gtk_combo_box in GTK v 2.4
svn path=/trunk/; revision=30592
Diffstat (limited to 'gtk')
-rw-r--r--gtk/find_dlg.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/gtk/find_dlg.c b/gtk/find_dlg.c
index 6f0f7dabcb..8766f588d1 100644
--- a/gtk/find_dlg.c
+++ b/gtk/find_dlg.c
@@ -126,10 +126,7 @@ find_frame_cb(GtkWidget *w _U_, gpointer d _U_)
*bbox, *ok_bt, *cancel_bt, *help_bt;
GtkTooltips *tooltips;
-#if GTK_CHECK_VERSION(2,6,0)
-#else
- GList *glist = NULL;
-#endif
+
/* No Apply button, but "OK" not only sets our text widget, it
activates it (i.e., it causes us to do the search). */
static construct_args_t args = {
@@ -288,7 +285,7 @@ find_frame_cb(GtkWidget *w _U_, gpointer d _U_)
/* Character Type Selection Dropdown Box
These only apply to the string find option */
/* Create Combo Box */
- #if GTK_CHECK_VERSION(2,6,0)
+
combo_cb = gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(combo_cb), "ASCII Unicode & Non-Unicode");
@@ -297,18 +294,7 @@ find_frame_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_cb),0);
gtk_container_add(GTK_CONTAINER(string_opt_vb), combo_cb);
-#else
- combo_cb = gtk_combo_new();
- glist = g_list_append(glist, "ASCII Unicode & Non-Unicode");
- glist = g_list_append(glist, "ASCII Non-Unicode");
- glist = g_list_append(glist, "ASCII Unicode");
- gtk_combo_set_popdown_strings(GTK_COMBO(combo_cb), glist);
- g_list_free(glist);
- /* You only get to choose from the options we offer */
- gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(combo_cb)->entry), FALSE);
-
-#endif
gtk_widget_show(combo_cb);
@@ -559,13 +545,14 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
{
GtkWidget *filter_te, *up_rb, *hex_rb, *string_rb, *combo_cb,
*case_cb, *decode_data_rb, *summary_data_rb;
- const gchar *filter_text, *string_type;
+ const gchar *filter_text;
search_charset_t scs_type = SCS_ASCII_AND_UNICODE;
guint8 *bytes = NULL;
size_t nbytes = 0;
char *string = NULL;
dfilter_t *sfcode = NULL;
gboolean found_packet=FALSE;
+ int string_type;
filter_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_FILT_KEY);
up_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_FIND_BACKWARD_KEY);
@@ -577,11 +564,18 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
summary_data_rb = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SOURCE_SUMMARY_KEY);
filter_text = gtk_entry_get_text(GTK_ENTRY(filter_te));
-#if GTK_CHECK_VERSION(2,6,0)
- string_type = gtk_combo_box_get_active_text(GTK_COMBO_BOX(combo_cb));
-#else
- string_type = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo_cb)->entry));
-#endif
+
+ /* Corresponds to the enum in file.c
+ * Character set for text search.
+ * typedef enum {
+ * SCS_ASCII_AND_UNICODE,
+ * SCS_ASCII,
+ * SCS_UNICODE
+ * / * add EBCDIC when it's implemented * /
+ * } search_charset_t;
+ */
+ string_type = gtk_combo_box_get_active (GTK_COMBO_BOX(combo_cb));
+
case_type = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(case_cb));
decode_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(decode_data_rb));
summary_data = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(summary_data_rb));
@@ -614,11 +608,11 @@ find_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w)
/*
* We are - get the character set type.
*/
- if (strcmp(string_type, "ASCII Unicode & Non-Unicode") == 0)
+ if (string_type == SCS_ASCII_AND_UNICODE)
scs_type = SCS_ASCII_AND_UNICODE;
- else if (strcmp(string_type, "ASCII Non-Unicode") == 0)
+ else if (string_type == SCS_ASCII)
scs_type = SCS_ASCII;
- else if (strcmp(string_type, "ASCII Unicode") == 0)
+ else if (string_type == SCS_UNICODE)
scs_type = SCS_UNICODE;
else {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "You didn't choose a valid character set.");