diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2013-01-04 09:35:53 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2013-01-04 09:35:53 +0000 |
| commit | f3ebae385211512a9cbd727b5aa532f6aa1b711b (patch) | |
| tree | 52dc68f71cc252254ffebdbcd1107d35aa9fa895 /src | |
| parent | Re-add omitted UI pref from prefences dialog rewrite (diff) | |
| download | inkscape-f3ebae385211512a9cbd727b5aa532f6aa1b711b.tar.gz inkscape-f3ebae385211512a9cbd727b5aa532f6aa1b711b.zip | |
ocaldialog: Use GtkSearchEntry in Gtk+ >= 3.6
(bzr r12008)
Diffstat (limited to 'src')
| -rw-r--r-- | src/device-manager.cpp | 9 | ||||
| -rw-r--r-- | src/ege-select-one-action.cpp | 20 | ||||
| -rw-r--r-- | src/ink-comboboxentry-action.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/ocaldialogs.cpp | 9 | ||||
| -rw-r--r-- | src/ui/dialog/ocaldialogs.h | 13 |
5 files changed, 23 insertions, 38 deletions
diff --git a/src/device-manager.cpp b/src/device-manager.cpp index 29efa2627..a9394a5f6 100644 --- a/src/device-manager.cpp +++ b/src/device-manager.cpp @@ -42,12 +42,7 @@ static bool isValidDevice(GdkDevice *device) gboolean source_matches = (gdk_device_get_source (device) == fakeout[i].source); gboolean mode_matches = (gdk_device_get_mode (device) == fakeout[i].mode); gboolean num_axes_matches = (gdk_device_get_n_axes (device) == fakeout[i].num_axes); - -#if GTK_CHECK_VERSION (2, 24, 0) gboolean num_keys_matches = (gdk_device_get_n_keys (device) == fakeout[i].num_keys); -#else - gboolean num_keys_matches = (device->num_keys == fakeout[i].num_keys); -#endif if (name_matches && source_matches && mode_matches && num_axes_matches && num_keys_matches) @@ -683,11 +678,7 @@ static void createFakeList() { fakeout[4].mode = gdk_device_get_mode (device); fakeout[4].has_cursor = gdk_device_get_has_cursor (device); fakeout[4].num_axes = gdk_device_get_n_axes (device); -#if GTK_CHECK_VERSION (2, 24, 0) fakeout[4].num_keys = gdk_device_get_n_keys (device); -#else - fakeout[4].num_keys = device->num_keys; -#endif } else { fakeout[4].name = g_strdup("Core Pointer"); fakeout[4].source = GDK_SOURCE_MOUSE; diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index a0c91d09e..a5d92e809 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -785,15 +785,8 @@ GtkWidget* create_tool_item( GtkAction* action ) GtkWidget *normal; if (act->private_data->selectionMode == SELECTION_OPEN) { - -// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24 -// and gtk_combo_box_set_entry_text_column is unavailable in earlier versions. -#if GTK_CHECK_VERSION (2, 24, 0) normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn); -#else - normal = gtk_combo_box_entry_new_with_model (act->private_data->model, act->private_data->labelColumn); -#endif GtkWidget *child = gtk_bin_get_child( GTK_BIN(normal) ); if (GTK_IS_ENTRY(child)) { @@ -897,13 +890,7 @@ void resync_active( EgeSelectOneAction* act, gint active, gboolean override ) } if ( GTK_IS_COMBO_BOX(combodata) ) { GtkComboBox* combo = GTK_COMBO_BOX(combodata); -// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24 -// gtk_combo_box_get_has_entry is unavailable in earlier versions -#if GTK_CHECK_VERSION (2, 24, 0) if ((active == -1) && (gtk_combo_box_get_has_entry(combo))) { -#else - if ((active == -1) && (GTK_IS_COMBO_BOX_ENTRY(combo))) { -#endif gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo))), act->private_data->activeText); } else if ( gtk_combo_box_get_active(combo) != active ) { gtk_combo_box_set_active( combo, active ); @@ -1019,10 +1006,6 @@ void combo_changed_cb( GtkComboBox* widget, gpointer user_data ) GtkComboBox *cb = GTK_COMBO_BOX (widget); gint newActive = gtk_combo_box_get_active(widget); -// Backward-compatibility: gtk_combo_box_get_active_text is deprecated in -// GTK+ >= 2.24. gtk_combo_box_get_has_entry is unavailable in earlier -// versions. -#if GTK_CHECK_VERSION (2, 24, 0) if (gtk_combo_box_get_has_entry (cb)) { GtkBin *bin = GTK_BIN (cb); GtkEntry *entry = GTK_ENTRY (gtk_bin_get_child (bin)); @@ -1038,9 +1021,6 @@ void combo_changed_cb( GtkComboBox* widget, gpointer user_data ) gtk_tree_model_get (model, &iter, 0, &text, -1); } } -#else - text = gtk_combo_box_get_active_text (cb); -#endif if (!text) { /* User probably deleted the data in the model */ diff --git a/src/ink-comboboxentry-action.cpp b/src/ink-comboboxentry-action.cpp index 14f8f83a6..8033d1fab 100644 --- a/src/ink-comboboxentry-action.cpp +++ b/src/ink-comboboxentry-action.cpp @@ -361,16 +361,8 @@ GtkWidget* create_tool_item( GtkAction* action ) item = GTK_WIDGET( gtk_tool_item_new() ); - GtkWidget* comboBoxEntry; - -// Backward-compatibility: GtkComboBoxEntry is deprecated in GTK+ >= 2.24 -// gtk_combo_box_set_entry_text_column is unavailable in earlier versions -#if GTK_CHECK_VERSION (2, 24, 0) - comboBoxEntry = gtk_combo_box_new_with_model_and_entry (ink_comboboxentry_action->model); + GtkWidget* comboBoxEntry = gtk_combo_box_new_with_model_and_entry (ink_comboboxentry_action->model); gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (comboBoxEntry), 0); -#else - comboBoxEntry = gtk_combo_box_entry_new_with_model( ink_comboboxentry_action->model, 0 ); -#endif // Name it so we can muck with it using an RC file gtk_widget_set_name( comboBoxEntry, combobox_name ); diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 82bc85099..75c766566 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -561,6 +561,7 @@ void StatusWidget::end_process() clear(); } +#if !GTK_CHECK_VERSION(3,6,0) SearchEntry::SearchEntry() : Gtk::Entry() { signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed)); @@ -589,6 +590,8 @@ void SearchEntry::_on_changed() set_icon_from_stock(Gtk::Stock::CLEAR, Gtk::ENTRY_ICON_SECONDARY); } } +#endif + BaseBox::BaseBox() : Gtk::EventBox() { @@ -1208,7 +1211,13 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types BaseBox *basebox_no_search_results = new BaseBox(); label_not_found = new Gtk::Label(); label_description = new Gtk::Label(); + +#if GTK_CHECK_VERSION(3,6,0) + entry_search = new Gtk::SearchEntry(); +#else entry_search = new SearchEntry(); +#endif + button_search = new Gtk::Button(_("Search")); #if WITH_GTKMM_3_0 diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 1cdfa15bb..326542579 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -21,6 +21,11 @@ #include <gtkmm/listviewtext.h> #include <gtkmm/scrolledwindow.h> #include <gtkmm/window.h> + +#if GTK_CHECK_VERSION(3,6,0) +# include <gtkmm/searchentry.h> +#endif + #include <giomm/file.h> //Inkscape includes @@ -328,6 +333,7 @@ public: Gtk::Label* label; }; +#if !GTK_CHECK_VERSION(3,6,0) /** * A Gtk::Entry with search & clear icons */ @@ -340,6 +346,7 @@ private: void _on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event); void _on_changed(); }; +#endif /** * A box which paints an overlay of the OCAL logo @@ -449,7 +456,13 @@ protected: private: Glib::ustring filename_image; Glib::ustring filename_thumbnail; + +#if GTK_CHECK_VERSION(3,6,0) + Gtk::SearchEntry *entry_search; +#else SearchEntry *entry_search; +#endif + LogoArea *drawingarea_logo; SearchResultList *list_results; PreviewWidget *preview_files; |
