From a8f1ee6d025f7c8bf374701d5a29baf9a04be026 Mon Sep 17 00:00:00 2001 From: Jonathan Matthew Date: Mon, 23 Feb 2009 12:23:53 +0000 Subject: [PATCH] Replace GtkOptionMenu with GtkComboBox in the query creator. 2009-02-23 Jonathan Matthew * data/glade/create-playlist.glade: * widgets/rb-query-creator-properties.c: (update_time_unit_limits), (create_time_unit_option_menu), (relativeTimeCriteriaCreateWidget), (relativeTimeCriteriaSetWidgetData), (relativeTimeCriteriaGetWidgetData): * widgets/rb-query-creator.c: (rb_query_creator_load_query), (rb_query_creator_set_sorting), (rb_query_creator_get_query), (rb_query_creator_get_limit), (rb_query_creator_get_sort_order), (append_row), (select_criteria_from_value), (property_option_menu_changed), (create_property_option_menu), (create_criteria_option_menu), (sort_option_menu_changed), (setup_sort_option_menu): Replace GtkOptionMenu with GtkComboBox in the query creator. * lib/rb-string-value-map.h: * plugins/visualizer/rb-vis-widget.h: * widgets/rb-cell-renderer-pixbuf.h: * widgets/rb-cell-renderer-rating.h: * widgets/rb-rating.h: Replace GTK_CHECK macros with G_TYPE_CHECK equivalents. * lib/rb-tree-dnd.c: (scroll_row_timeout): * widgets/gossip-cell-renderer-expander.c: (gossip_cell_renderer_expander_activate): * widgets/rb-cell-renderer-pixbuf.c: (rb_cell_renderer_pixbuf_new), (rb_cell_renderer_pixbuf_activate): * widgets/rb-cell-renderer-rating.c: (rb_cell_renderer_rating_new), (rb_cell_renderer_rating_activate): Replace gtk_tree_view_widget_to_tree_coords. * widgets/rb-property-view.c: (rb_property_view_set_search_func): * widgets/rb-property-view.h: Replace GtkDestroyNotify with GDestroyNotify. No more deprecated gtk+ stuff. Fixes #564800. svn path=/trunk/; revision=6159 --- ChangeLog | 38 ++ data/glade/create-playlist.glade | 638 ++++++++++-------------- lib/rb-string-value-map.h | 8 +- lib/rb-tree-dnd.c | 2 +- plugins/visualizer/rb-vis-widget.h | 10 +- widgets/gossip-cell-renderer-expander.c | 8 +- widgets/rb-cell-renderer-pixbuf.c | 10 +- widgets/rb-cell-renderer-pixbuf.h | 12 +- widgets/rb-cell-renderer-rating.c | 10 +- widgets/rb-cell-renderer-rating.h | 12 +- widgets/rb-property-view.c | 2 +- widgets/rb-property-view.h | 2 +- widgets/rb-query-creator-properties.c | 26 +- widgets/rb-query-creator.c | 168 +++---- widgets/rb-rating.h | 10 +- 15 files changed, 425 insertions(+), 531 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b8a46f0a..8efdd2cb5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2009-02-23 Jonathan Matthew + + * data/glade/create-playlist.glade: + * widgets/rb-query-creator-properties.c: (update_time_unit_limits), + (create_time_unit_option_menu), (relativeTimeCriteriaCreateWidget), + (relativeTimeCriteriaSetWidgetData), + (relativeTimeCriteriaGetWidgetData): + * widgets/rb-query-creator.c: (rb_query_creator_load_query), + (rb_query_creator_set_sorting), (rb_query_creator_get_query), + (rb_query_creator_get_limit), (rb_query_creator_get_sort_order), + (append_row), (select_criteria_from_value), + (property_option_menu_changed), (create_property_option_menu), + (create_criteria_option_menu), (sort_option_menu_changed), + (setup_sort_option_menu): + Replace GtkOptionMenu with GtkComboBox in the query creator. + + * lib/rb-string-value-map.h: + * plugins/visualizer/rb-vis-widget.h: + * widgets/rb-cell-renderer-pixbuf.h: + * widgets/rb-cell-renderer-rating.h: + * widgets/rb-rating.h: + Replace GTK_CHECK macros with G_TYPE_CHECK equivalents. + + * lib/rb-tree-dnd.c: (scroll_row_timeout): + * widgets/gossip-cell-renderer-expander.c: + (gossip_cell_renderer_expander_activate): + * widgets/rb-cell-renderer-pixbuf.c: (rb_cell_renderer_pixbuf_new), + (rb_cell_renderer_pixbuf_activate): + * widgets/rb-cell-renderer-rating.c: (rb_cell_renderer_rating_new), + (rb_cell_renderer_rating_activate): + Replace gtk_tree_view_widget_to_tree_coords. + + * widgets/rb-property-view.c: (rb_property_view_set_search_func): + * widgets/rb-property-view.h: + Replace GtkDestroyNotify with GDestroyNotify. + + No more deprecated gtk+ stuff. Fixes #564800. + 2009-02-22 Jonathan Matthew * plugins/rb/Loader.py: diff --git a/data/glade/create-playlist.glade b/data/glade/create-playlist.glade index 8ecf705ea..b9c5b3f64 100644 --- a/data/glade/create-playlist.glade +++ b/data/glade/create-playlist.glade @@ -1,378 +1,264 @@ - - - + - - - - 5 - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - False - False - False - - - - True - False - 2 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - -6 - - - - - - True - True - True - gtk-new - True - GTK_RELIEF_NORMAL - -5 - - - - - - True - True - True - gtk-help - True - GTK_RELIEF_NORMAL - -11 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 5 - True - False - 6 - - - - True - False - 6 - - - - True - Create automatically updating playlist where: - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - False - True - - - - - - True - False - 6 - - - - - - - 0 - False - False - - - - - - True - False - 6 - - - - True - False - 0 - - - - True - True - A_dd if any criteria are matched - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - - True - True - gtk-add - True - GTK_RELIEF_NORMAL - - - 0 - False - False - GTK_PACK_END - - - - - 0 - False - False - - - - - - True - False - 12 - - - - True - True - _Limit to: - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - - True - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 1 1 100000 1 10 0 - - - 0 - False - False - - - - - - True - True - 0 - - - - - - - True - songs - True - - - - - - True - MB - True - - - - - - True - GB - True - - - - - - True - Minutes - True - - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True - False - 12 - - - - True - _When sorted by: - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - sortMenu - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - True - -1 - - - - - - - - 0 - True - True - - - - - - True - True - - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - GTK_PACK_END - - - - - 0 - True - True - - - - - 0 - False - False - - - - - 0 - False - False - - - - - - + + + True + 5 + False + GDK_WINDOW_TYPE_HINT_NORMAL + False + + + True + 2 + + + True + 5 + 6 + + + True + 6 + + + True + 0 + Create automatically updating playlist where: + True + + + False + False + 0 + + + + + False + 0 + + + + + True + 6 + + + + + + False + False + 1 + + + + + True + 6 + + + True + + + True + True + A_dd if any criteria are matched + True + True + + + False + False + 0 + + + + + True + True + gtk-add + True + + + False + False + GTK_PACK_END + 1 + + + + + False + False + 0 + + + + + True + 12 + + + True + True + _Limit to: + True + True + + + False + False + 0 + + + + + True + True + 1 1 100000 1 10 0 + 1 + True + + + False + False + 1 + + + + + True + songs +MB +GB +Minutes + + + 2 + + + + + 1 + + + + + True + 12 + + + True + _When sorted by: + True + + + False + False + 0 + + + + + True + + + + 1 + + + + + True + True + True + True + + + False + False + GTK_PACK_END + 2 + + + + + 2 + + + + + False + False + 2 + + + + + False + False + 1 + + + + + True + GTK_BUTTONBOX_END + + + True + True + True + gtk-cancel + True + -6 + + + False + False + 0 + + + + + True + True + True + gtk-new + True + -5 + + + False + False + 1 + + + + + True + True + True + gtk-help + True + -11 + + + False + False + 2 + + + + + False + GTK_PACK_END + 0 + + + + + diff --git a/lib/rb-string-value-map.h b/lib/rb-string-value-map.h index d71b82ef7..407734bf8 100644 --- a/lib/rb-string-value-map.h +++ b/lib/rb-string-value-map.h @@ -33,10 +33,10 @@ G_BEGIN_DECLS #define RB_TYPE_STRING_VALUE_MAP (rb_string_value_map_get_type ()) -#define RB_STRING_VALUE_MAP(obj) (GTK_CHECK_CAST ((obj), RB_TYPE_STRING_VALUE_MAP, RBStringValueMap)) -#define RB_STRING_VALUE_MAP_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), RB_TYPE_STRING_VALUE_MAP, RBStringValueMapClass)) -#define RB_IS_STRING_VALUE_MAP(obj) (GTK_CHECK_TYPE ((obj), RB_TYPE_STRING_VALUE_MAP)) -#define RB_IS_STRING_VALUE_MAP_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), RB_TYPE_STRING_VALUE_MAP)) +#define RB_STRING_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), RB_TYPE_STRING_VALUE_MAP, RBStringValueMap)) +#define RB_STRING_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RB_TYPE_STRING_VALUE_MAP, RBStringValueMapClass)) +#define RB_IS_STRING_VALUE_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RB_TYPE_STRING_VALUE_MAP)) +#define RB_IS_STRING_VALUE_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RB_TYPE_STRING_VALUE_MAP)) typedef struct _RBStringValueMap RBStringValueMap; typedef struct _RBStringValueMapClass RBStringValueMapClass; diff --git a/lib/rb-tree-dnd.c b/lib/rb-tree-dnd.c index a9ca3ce26..0e1c683ca 100644 --- a/lib/rb-tree-dnd.c +++ b/lib/rb-tree-dnd.c @@ -474,7 +474,7 @@ scroll_row_timeout (gpointer data) g_return_val_if_fail(priv_data != NULL, TRUE); gdk_window_get_pointer (gtk_tree_view_get_bin_window (tree_view), &x, &y, NULL); - gtk_tree_view_widget_to_tree_coords (tree_view, x, y, &x, &y); + gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y); gtk_tree_view_get_visible_rect (tree_view, &visible_rect); /* see if we are near the edge. */ diff --git a/plugins/visualizer/rb-vis-widget.h b/plugins/visualizer/rb-vis-widget.h index 1713c74e3..401dd4475 100644 --- a/plugins/visualizer/rb-vis-widget.h +++ b/plugins/visualizer/rb-vis-widget.h @@ -32,11 +32,11 @@ G_BEGIN_DECLS #define RB_TYPE_VIS_WIDGET (rb_vis_widget_get_type ()) -#define RB_VIS_WIDGET(obj) (GTK_CHECK_CAST ((obj), RB_TYPE_VIS_WIDGET, RBVisWidget)) -#define RB_VIS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), RB_TYPE_VIS_WIDGET, RBVisWidgetClass)) -#define RB_IS_VIS_WIDGET(obj) (GTK_CHECK_TYPE ((obj), RB_TYPE_VIS_WIDGET)) -#define RB_IS_VIS_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), RB_TYPE_VIS_WIDGET)) -#define RB_VIS_WIDGET_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), RB_TYPE_VIS_WIDGET, RBVisWidgetClass)) +#define RB_VIS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_VIS_WIDGET, RBVisWidget)) +#define RB_VIS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RB_TYPE_VIS_WIDGET, RBVisWidgetClass)) +#define RB_IS_VIS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_VIS_WIDGET)) +#define RB_IS_VIS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RB_TYPE_VIS_WIDGET)) +#define RB_VIS_WIDGET_GET_CLASS(obj) (G_TYPE_CHECK_GET_CLASS ((obj), RB_TYPE_VIS_WIDGET, RBVisWidgetClass)) typedef struct _RBVisWidget { diff --git a/widgets/gossip-cell-renderer-expander.c b/widgets/gossip-cell-renderer-expander.c index 784bc748d..234a5353c 100644 --- a/widgets/gossip-cell-renderer-expander.c +++ b/widgets/gossip-cell-renderer-expander.c @@ -457,11 +457,9 @@ gossip_cell_renderer_expander_activate (GtkCellRenderer *cell, path = gtk_tree_path_new_from_string (path_string); gtk_widget_get_pointer (widget, &mouse_x, &mouse_y); - gtk_tree_view_widget_to_tree_coords (GTK_TREE_VIEW (widget), - mouse_x, - mouse_y, - &mouse_x, - &mouse_y); + gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget), + mouse_x, mouse_y, + &mouse_x, &mouse_y); /* check if click is within the cell */ if (mouse_x - cell_area->x >= 0 diff --git a/widgets/rb-cell-renderer-pixbuf.c b/widgets/rb-cell-renderer-pixbuf.c index cd4c91b6a..80dbb8d28 100644 --- a/widgets/rb-cell-renderer-pixbuf.c +++ b/widgets/rb-cell-renderer-pixbuf.c @@ -195,7 +195,7 @@ rb_cell_renderer_pixbuf_set_property (GObject *object, GtkCellRenderer * rb_cell_renderer_pixbuf_new (void) { - return GTK_CELL_RENDERER (gtk_type_new (rb_cell_renderer_pixbuf_get_type ())); + return GTK_CELL_RENDERER (g_object_new (rb_cell_renderer_pixbuf_get_type (), NULL, NULL)); } static void @@ -321,11 +321,9 @@ rb_cell_renderer_pixbuf_activate (GtkCellRenderer *cell, gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_width, NULL); gtk_widget_get_pointer (widget, &mouse_x, &mouse_y); - gtk_tree_view_widget_to_tree_coords (GTK_TREE_VIEW (widget), - mouse_x, - mouse_y, - &mouse_x, - &mouse_y); + gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget), + mouse_x, mouse_y, + &mouse_x, &mouse_y); /* ensure the user clicks within the good cell */ if (mouse_x - cell_area->x >= 0 diff --git a/widgets/rb-cell-renderer-pixbuf.h b/widgets/rb-cell-renderer-pixbuf.h index 570f9974a..b0892dc68 100644 --- a/widgets/rb-cell-renderer-pixbuf.h +++ b/widgets/rb-cell-renderer-pixbuf.h @@ -31,11 +31,11 @@ extern "C" { #endif /* __cplusplus */ #define RB_TYPE_CELL_RENDERER_PIXBUF (rb_cell_renderer_pixbuf_get_type ()) -#define RB_CELL_RENDERER_PIXBUF(obj) (GTK_CHECK_CAST ((obj), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbuf)) -#define RB_CELL_RENDERER_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbufClass)) -#define RB_IS_CELL_RENDERER_PIXBUF(obj) (GTK_CHECK_TYPE ((obj), RB_TYPE_CELL_RENDERER_PIXBUF)) -#define RB_IS_CELL_RENDERER_PIXBUF_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), RB_TYPE_CELL_RENDERER_PIXBUF)) -#define RB_CELL_RENDERER_PIXBUF_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbufClass)) +#define RB_CELL_RENDERER_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbuf)) +#define RB_CELL_RENDERER_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbufClass)) +#define RB_IS_CELL_RENDERER_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_CELL_RENDERER_PIXBUF)) +#define RB_IS_CELL_RENDERER_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RB_TYPE_CELL_RENDERER_PIXBUF)) +#define RB_CELL_RENDERER_PIXBUF_GET_CLASS(obj) (G_TYPE_CHECK_GET_CLASS ((obj), RB_TYPE_CELL_RENDERER_PIXBUF, RBCellRendererPixbufClass)) typedef struct _RBCellRendererPixbuf RBCellRendererPixbuf; typedef struct _RBCellRendererPixbufClass RBCellRendererPixbufClass; @@ -54,7 +54,7 @@ struct _RBCellRendererPixbufClass void (*pixbuf_clicked) (RBCellRendererPixbuf *renderer, GtkTreePath *path); }; -GtkType rb_cell_renderer_pixbuf_get_type (void); +GType rb_cell_renderer_pixbuf_get_type (void); GtkCellRenderer *rb_cell_renderer_pixbuf_new (void); #ifdef __cplusplus diff --git a/widgets/rb-cell-renderer-rating.c b/widgets/rb-cell-renderer-rating.c index 7c2acd2e8..92f0a5b11 100644 --- a/widgets/rb-cell-renderer-rating.c +++ b/widgets/rb-cell-renderer-rating.c @@ -226,7 +226,7 @@ rb_cell_renderer_rating_set_property (GObject *object, GtkCellRenderer * rb_cell_renderer_rating_new () { - return GTK_CELL_RENDERER (gtk_type_new (rb_cell_renderer_rating_get_type ())); + return GTK_CELL_RENDERER (g_object_new (rb_cell_renderer_rating_get_type (), NULL, NULL)); } static void @@ -313,11 +313,9 @@ rb_cell_renderer_rating_activate (GtkCellRenderer *cell, g_return_val_if_fail (RB_IS_CELL_RENDERER_RATING (cellrating), FALSE); gtk_widget_get_pointer (widget, &mouse_x, &mouse_y); - gtk_tree_view_widget_to_tree_coords (GTK_TREE_VIEW (widget), - mouse_x, - mouse_y, - &mouse_x, - &mouse_y); + gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget), + mouse_x, mouse_y, + &mouse_x, &mouse_y); rating = rb_rating_get_rating_from_widget (widget, mouse_x - cell_area->x, diff --git a/widgets/rb-cell-renderer-rating.h b/widgets/rb-cell-renderer-rating.h index a9b627988..f8c92dd09 100644 --- a/widgets/rb-cell-renderer-rating.h +++ b/widgets/rb-cell-renderer-rating.h @@ -29,11 +29,11 @@ G_BEGIN_DECLS #define RB_TYPE_CELL_RENDERER_RATING (rb_cell_renderer_rating_get_type ()) -#define RB_CELL_RENDERER_RATING(obj) (GTK_CHECK_CAST ((obj), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRating)) -#define RB_CELL_RENDERER_RATING_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass)) -#define RB_IS_CELL_RENDERER_RATING(obj) (GTK_CHECK_TYPE ((obj), RB_TYPE_CELL_RENDERER_RATING)) -#define RB_IS_CELL_RENDERER_RATING_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), RB_TYPE_CELL_RENDERER_RATING)) -#define RB_CELL_RENDERER_RATING_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass)) +#define RB_CELL_RENDERER_RATING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRating)) +#define RB_CELL_RENDERER_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass)) +#define RB_IS_CELL_RENDERER_RATING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_CELL_RENDERER_RATING)) +#define RB_IS_CELL_RENDERER_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RB_TYPE_CELL_RENDERER_RATING)) +#define RB_CELL_RENDERER_RATING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RB_TYPE_CELL_RENDERER_RATING, RBCellRendererRatingClass)) typedef struct RBCellRendererRatingPrivate RBCellRendererRatingPrivate; typedef struct RBCellRendererRatingClassPrivate RBCellRendererRatingClassPrivate; @@ -57,7 +57,7 @@ struct _RBCellRendererRatingClass }; -GtkType rb_cell_renderer_rating_get_type (void); +GType rb_cell_renderer_rating_get_type (void); GtkCellRenderer *rb_cell_renderer_rating_new (void); diff --git a/widgets/rb-property-view.c b/widgets/rb-property-view.c index 2cba6d1de..9916055ae 100644 --- a/widgets/rb-property-view.c +++ b/widgets/rb-property-view.c @@ -961,7 +961,7 @@ void rb_property_view_set_search_func (RBPropertyView *view, GtkTreeViewSearchEqualFunc func, gpointer func_data, - GtkDestroyNotify notify) + GDestroyNotify notify) { g_return_if_fail (RB_IS_PROPERTY_VIEW (view)); diff --git a/widgets/rb-property-view.h b/widgets/rb-property-view.h index 770be667f..179a2726b 100644 --- a/widgets/rb-property-view.h +++ b/widgets/rb-property-view.h @@ -96,7 +96,7 @@ guint rb_property_view_get_num_properties (RBPropertyView *view); void rb_property_view_set_search_func (RBPropertyView *view, GtkTreeViewSearchEqualFunc func, gpointer func_data, - GtkDestroyNotify notify); + GDestroyNotify notify); G_END_DECLS diff --git a/widgets/rb-query-creator-properties.c b/widgets/rb-query-creator-properties.c index 9b6c5acc6..5d63e30d7 100644 --- a/widgets/rb-query-creator-properties.c +++ b/widgets/rb-query-creator-properties.c @@ -469,12 +469,12 @@ durationCriteriaGetWidgetData (GtkWidget *widget, GValue *val) */ static void -update_time_unit_limits (GtkOptionMenu *menu, GtkWidget *spin_button) +update_time_unit_limits (GtkComboBox *menu, GtkWidget *spin_button) { /* set the range on the spin button so it can't overflow when * converted to seconds when we're constructing the query */ - gulong mult = time_unit_options [gtk_option_menu_get_history (menu)].timeMultiplier; + gulong mult = time_unit_options [gtk_combo_box_get_active (menu)].timeMultiplier; gtk_spin_button_set_range (GTK_SPIN_BUTTON (spin_button), 1, G_MAXINT / mult); } @@ -482,19 +482,15 @@ static GtkWidget* create_time_unit_option_menu (const RBQueryCreatorTimeUnitOption *options, int length) { - GtkWidget *menu = gtk_menu_new (); - GtkWidget *option_menu = gtk_option_menu_new (); + GtkWidget *combo; int i; + combo = gtk_combo_box_new_text (); for (i = 0; i < length; i++) { - GtkWidget *menu_item = gtk_menu_item_new_with_label (_(options[i].name)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i].name)); } - gtk_widget_show_all (menu); - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); - - return option_menu; + return combo; } static GtkWidget * @@ -511,7 +507,7 @@ relativeTimeCriteriaCreateWidget (gboolean *constrain) gtk_box_pack_start (box, timeSpin, TRUE, TRUE, 0); timeOption = create_time_unit_option_menu (time_unit_options, G_N_ELEMENTS (time_unit_options)); - gtk_option_menu_set_history (GTK_OPTION_MENU (timeOption), time_unit_options_default); + gtk_combo_box_set_active (GTK_COMBO_BOX (timeOption), time_unit_options_default); gtk_box_pack_start (box, timeOption, TRUE, TRUE, 0); g_signal_connect_object (timeOption, "changed", @@ -528,7 +524,7 @@ relativeTimeCriteriaSetWidgetData (GtkWidget *widget, GValue *val) GtkBox *box = GTK_BOX (widget); GtkSpinButton *timeSpin = GTK_SPIN_BUTTON (get_box_widget_at_pos (box, 0)); - GtkOptionMenu *unitMenu = GTK_OPTION_MENU (get_box_widget_at_pos (box, 1)); + GtkComboBox *unitMenu = GTK_COMBO_BOX (get_box_widget_at_pos (box, 1)); gulong time = g_value_get_ulong (val); gulong unit = 0; @@ -544,7 +540,7 @@ relativeTimeCriteriaSetWidgetData (GtkWidget *widget, GValue *val) time = time / time_unit_options[unit].timeMultiplier; g_assert (time < G_MAXINT); /* set the time value and unit*/ - gtk_option_menu_set_history (unitMenu, unit); + gtk_combo_box_set_active (unitMenu, unit); gtk_spin_button_set_value (timeSpin, time); } @@ -552,9 +548,9 @@ static void relativeTimeCriteriaGetWidgetData (GtkWidget *widget, GValue *val) { GtkSpinButton *timeSpin = GTK_SPIN_BUTTON (get_box_widget_at_pos (GTK_BOX (widget), 0)); - GtkOptionMenu *unitMenu = GTK_OPTION_MENU (get_box_widget_at_pos (GTK_BOX (widget), 1)); + GtkComboBox *unitMenu = GTK_COMBO_BOX (get_box_widget_at_pos (GTK_BOX (widget), 1)); - gulong timeMultiplier = time_unit_options [gtk_option_menu_get_history (unitMenu)].timeMultiplier; + gulong timeMultiplier = time_unit_options [gtk_combo_box_get_active (unitMenu)].timeMultiplier; gint value = gtk_spin_button_get_value_as_int (timeSpin) * timeMultiplier; g_assert (value >= 0); diff --git a/widgets/rb-query-creator.c b/widgets/rb-query-creator.c index efbc00309..a76c6cc37 100644 --- a/widgets/rb-query-creator.c +++ b/widgets/rb-query-creator.c @@ -77,7 +77,7 @@ static void limit_toggled_cb (GtkWidget *limit, RBQueryCreator *creator); static int get_property_index_from_proptype (const RBQueryCreatorPropertyOption *options, int length, RhythmDBPropType prop); -static void sort_option_menu_changed (GtkOptionMenu *propmenu, RBQueryCreator *creator); +static void sort_option_menu_changed (GtkComboBox *propmenu, RBQueryCreator *creator); typedef struct { @@ -355,6 +355,7 @@ rb_query_creator_load_query (RBQueryCreator *creator, gboolean disjunction = FALSE; RhythmDBQueryData *qdata; GPtrArray *subquery; + guint64 limit; g_return_val_if_fail (query->len == 2, FALSE); @@ -363,18 +364,19 @@ rb_query_creator_load_query (RBQueryCreator *creator, subquery = qdata->subquery; - if (subquery->len > 0) + if (subquery->len > 0) { for (i = 0; i < subquery->len; i++) { RhythmDBQueryData *data = g_ptr_array_index (subquery, i); if (data->type != RHYTHMDB_QUERY_DISJUNCTION) append_row (creator); } + } rows = priv->rows; for (i = 0; i < subquery->len; i++) { RhythmDBQueryData *data = g_ptr_array_index (subquery, i); - GtkOptionMenu *propmenu; + GtkComboBox *propmenu; GtkWidget *criteria_menu; int index; const RBQueryCreatorPropertyType *property_type; @@ -384,9 +386,9 @@ rb_query_creator_load_query (RBQueryCreator *creator, continue; } - propmenu = GTK_OPTION_MENU (get_box_widget_at_pos (GTK_BOX (rows->data), 0)); + propmenu = GTK_COMBO_BOX (get_box_widget_at_pos (GTK_BOX (rows->data), 0)); index = get_property_index_from_proptype (property_options, num_property_options, data->propid); - gtk_option_menu_set_history (propmenu, index); + gtk_combo_box_set_active (propmenu, index); criteria_menu = get_box_widget_at_pos (GTK_BOX (rows->data), 1); select_criteria_from_value (creator, criteria_menu, data->propid, data->type); @@ -400,48 +402,44 @@ rb_query_creator_load_query (RBQueryCreator *creator, } /* setup the limits */ - { - guint64 limit; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->disjunction_check), - disjunction); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->limit_check), - limit_type != RHYTHMDB_QUERY_MODEL_LIMIT_NONE); - - switch (limit_type) { - case RHYTHMDB_QUERY_MODEL_LIMIT_NONE: - limit = 0; - break; - - case RHYTHMDB_QUERY_MODEL_LIMIT_COUNT: - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->limit_option), 0); - limit = g_value_get_ulong (g_value_array_get_nth (limit_value, 0)); - break; + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->disjunction_check), + disjunction); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->limit_check), + limit_type != RHYTHMDB_QUERY_MODEL_LIMIT_NONE); + + switch (limit_type) { + case RHYTHMDB_QUERY_MODEL_LIMIT_NONE: + limit = 0; + break; - case RHYTHMDB_QUERY_MODEL_LIMIT_TIME: - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->limit_option), 3); - /* convert to minutes */ - limit = g_value_get_ulong (g_value_array_get_nth (limit_value, 0)) / 60; - break; + case RHYTHMDB_QUERY_MODEL_LIMIT_COUNT: + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->limit_option), 0); + limit = g_value_get_ulong (g_value_array_get_nth (limit_value, 0)); + break; - case RHYTHMDB_QUERY_MODEL_LIMIT_SIZE: - limit = g_value_get_uint64 (g_value_array_get_nth (limit_value, 0)); + case RHYTHMDB_QUERY_MODEL_LIMIT_TIME: + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->limit_option), 3); + /* convert to minutes */ + limit = g_value_get_ulong (g_value_array_get_nth (limit_value, 0)) / 60; + break; - if (limit % 1000 == 0) { - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->limit_option), 2); - limit /= 1000; - } else { - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->limit_option), 1); - } + case RHYTHMDB_QUERY_MODEL_LIMIT_SIZE: + limit = g_value_get_uint64 (g_value_array_get_nth (limit_value, 0)); - break; - default: - g_assert_not_reached (); + if (limit % 1000 == 0) { + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->limit_option), 2); + limit /= 1000; + } else { + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->limit_option), 1); } - gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->limit_entry), limit); + break; + default: + g_assert_not_reached (); } + gtk_spin_button_set_value (GTK_SPIN_BUTTON (priv->limit_entry), limit); + return TRUE; } @@ -469,8 +467,8 @@ rb_query_creator_set_sorting (RBQueryCreator *creator, /* check that it is a valid sort option */ g_return_val_if_fail (i < num_property_options, FALSE); - gtk_option_menu_set_history (GTK_OPTION_MENU (priv->sort_menu), i); - sort_option_menu_changed (GTK_OPTION_MENU (priv->sort_menu), creator); /* force the checkbox to change label */ + gtk_combo_box_set_active (GTK_COMBO_BOX (priv->sort_menu), i); + sort_option_menu_changed (GTK_COMBO_BOX (priv->sort_menu), creator); /* force the checkbox to change label */ return TRUE; } @@ -582,14 +580,14 @@ rb_query_creator_get_query (RBQueryCreator *creator) rows = priv->rows; for (row = rows; row; row = row->next) { - GtkOptionMenu *propmenu = GTK_OPTION_MENU (get_box_widget_at_pos (GTK_BOX (row->data), + GtkComboBox *propmenu = GTK_COMBO_BOX (get_box_widget_at_pos (GTK_BOX (row->data), 0)); - GtkOptionMenu *criteria_menu = GTK_OPTION_MENU (get_box_widget_at_pos (GTK_BOX (row->data), + GtkComboBox *criteria_menu = GTK_COMBO_BOX (get_box_widget_at_pos (GTK_BOX (row->data), 1)); - guint prop_position = gtk_option_menu_get_history (propmenu); + guint prop_position = gtk_combo_box_get_active (propmenu); const RBQueryCreatorPropertyOption *prop_option = &property_options[prop_position]; const RBQueryCreatorCriteriaOption *criteria_options = prop_option->property_type->criteria_options; - const RBQueryCreatorCriteriaOption *criteria_option = &criteria_options[gtk_option_menu_get_history (criteria_menu)]; + const RBQueryCreatorCriteriaOption *criteria_option = &criteria_options[gtk_combo_box_get_active (criteria_menu)]; g_assert (prop_option->property_type->criteria_get_widget_data != NULL); { @@ -650,7 +648,7 @@ rb_query_creator_get_limit (RBQueryCreator *creator, l = gtk_spin_button_get_value(GTK_SPIN_BUTTON (priv->limit_entry)); *limit = g_value_array_new (0); - switch (gtk_option_menu_get_history (GTK_OPTION_MENU (priv->limit_option))) { + switch (gtk_combo_box_get_active (GTK_COMBO_BOX (priv->limit_option))) { case 0: *type = RHYTHMDB_QUERY_MODEL_LIMIT_COUNT; rb_value_array_append_data (*limit, G_TYPE_ULONG, (gulong)l); @@ -708,7 +706,7 @@ rb_query_creator_get_sort_order (RBQueryCreator *creator, if (sort_key != NULL) { int i; - i = gtk_option_menu_get_history (GTK_OPTION_MENU (priv->sort_menu)); + i = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->sort_menu)); *sort_key = sort_options[i].sort_key; } } @@ -791,11 +789,11 @@ append_row (RBQueryCreator *creator) priv->rows = g_list_prepend (priv->rows, hbox); gtk_box_reorder_child (priv->vbox, GTK_WIDGET (hbox), -1); - /* This is the main (leftmost) GtkOptionMenu, for types. */ + /* This is the main (leftmost) GtkComboBox, for types. */ option = create_property_option_menu (creator, property_options, num_property_options); gtk_size_group_add_widget (priv->property_size_group, option); gtk_box_pack_start (hbox, GTK_WIDGET (option), TRUE, TRUE, 0); - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0); + gtk_combo_box_set_active (GTK_COMBO_BOX (option), 0); criteria = create_criteria_option_menu (property_options[0].property_type->criteria_options, property_options[0].property_type->num_criteria_options); gtk_size_group_add_widget (priv->criteria_size_group, criteria); @@ -846,7 +844,7 @@ select_criteria_from_value (RBQueryCreator *creator, for (i = 0; i < length; i++) { if (qtype == options[i].val) { - gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), i); + gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu), i); return; } } @@ -854,7 +852,7 @@ select_criteria_from_value (RBQueryCreator *creator, } static void -property_option_menu_changed (GtkOptionMenu *propmenu, +property_option_menu_changed (GtkComboBox *propmenu, RBQueryCreator *creator) { RBQueryCreatorPrivate *priv = QUERY_CREATOR_GET_PRIVATE (creator); @@ -867,7 +865,7 @@ property_option_menu_changed (GtkOptionMenu *propmenu, guint old_value; gboolean constrain; - prop_option = &property_options[gtk_option_menu_get_history (propmenu)]; + prop_option = &property_options[gtk_combo_box_get_active (propmenu)]; old_value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (propmenu), "prop-menu old-value")); /* don't recreate the criteria menu and entry if they will be the same*/ @@ -875,7 +873,7 @@ property_option_menu_changed (GtkOptionMenu *propmenu, return; g_object_set_data (G_OBJECT (propmenu), "prop-menu old-value", - GINT_TO_POINTER (gtk_option_menu_get_history (propmenu))); + GINT_TO_POINTER (gtk_combo_box_get_active (propmenu))); row = lookup_row_by_widget (creator, GTK_WIDGET (propmenu)); @@ -908,63 +906,46 @@ create_property_option_menu (RBQueryCreator *creator, const RBQueryCreatorPropertyOption *options, int length) { - GtkWidget *option_menu; - GtkWidget *menu; - GtkWidget *menu_item; + GtkWidget *combo; int i; - option_menu = gtk_option_menu_new (); - menu = gtk_menu_new (); - - /* add the property options */ + combo = gtk_combo_box_new_text (); for (i = 0; i < length; i++) { - menu_item = gtk_menu_item_new_with_label (_(options[i].name)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - gtk_widget_show (menu_item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i].name)); } - gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu), 0); - g_object_set_data (G_OBJECT (option_menu), "prop-menu old-value", GINT_TO_POINTER (0)); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); - gtk_widget_show (menu); + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); + + g_object_set_data (G_OBJECT (combo), "prop-menu old value", GINT_TO_POINTER (0)); - g_signal_connect_object (G_OBJECT (option_menu), "changed", + g_signal_connect_object (G_OBJECT (combo), "changed", G_CALLBACK (property_option_menu_changed), creator, 0); - return option_menu; + return combo; } static GtkWidget* create_criteria_option_menu (const RBQueryCreatorCriteriaOption *options, int length) { - GtkWidget *option_menu; - GtkWidget *menu; - GtkWidget *menu_item; + GtkWidget *combo; int i; - option_menu = gtk_option_menu_new (); - menu = gtk_menu_new (); - + combo = gtk_combo_box_new_text (); for (i = 0; i < length; i++) { - menu_item = gtk_menu_item_new_with_label (_(options[i].name)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - gtk_widget_show (menu_item); + gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _(options[i].name)); } + gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); - gtk_widget_show (menu); - - return option_menu; + return combo; } static void -sort_option_menu_changed (GtkOptionMenu *propmenu, +sort_option_menu_changed (GtkComboBox *propmenu, RBQueryCreator *creator) { RBQueryCreatorPrivate *priv = QUERY_CREATOR_GET_PRIVATE (creator); - int index = gtk_option_menu_get_history (propmenu); + int index = gtk_combo_box_get_active (propmenu); gtk_button_set_label (GTK_BUTTON (priv->sort_desc), _(sort_options[index].sort_descending_name)); rb_debug("changing descending label to %s[%d]", sort_options[index].sort_descending_name, index); @@ -976,21 +957,20 @@ setup_sort_option_menu (RBQueryCreator *creator, const RBQueryCreatorSortOption *options, int length) { - GtkWidget *menu; - GtkWidget *menu_item; + GtkListStore *store; int i; - menu = gtk_menu_new (); - gtk_widget_show (menu); + store = gtk_list_store_new (1, G_TYPE_STRING); for (i = 0; i < length; i++) { - menu_item = gtk_menu_item_new_with_label (_(options[i].name)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - gtk_widget_show (menu_item); + GtkTreeIter iter; + + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, 0, _(options[i].name), -1); } + gtk_combo_box_set_model (GTK_COMBO_BOX (option_menu), GTK_TREE_MODEL (store)); + g_signal_connect_object (G_OBJECT (option_menu), "changed", G_CALLBACK (sort_option_menu_changed), creator, 0); - - gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); } diff --git a/widgets/rb-rating.h b/widgets/rb-rating.h index 8e1891e1a..51fafde23 100644 --- a/widgets/rb-rating.h +++ b/widgets/rb-rating.h @@ -35,10 +35,10 @@ G_BEGIN_DECLS #define RB_TYPE_RATING (rb_rating_get_type ()) -#define RB_RATING(obj) (GTK_CHECK_CAST ((obj), RB_TYPE_RATING, RBRating)) -#define RB_RATING_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), RB_TYPE_RATING, RBRatingClass)) -#define RB_IS_RATING(obj) (GTK_CHECK_TYPE ((obj), RB_TYPE_RATING)) -#define RB_IS_RATING_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), RB_TYPE_RATING)) +#define RB_RATING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RB_TYPE_RATING, RBRating)) +#define RB_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RB_TYPE_RATING, RBRatingClass)) +#define RB_IS_RATING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RB_TYPE_RATING)) +#define RB_IS_RATING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RB_TYPE_RATING)) typedef struct _RBRating RBRating; typedef struct _RBRatingClass RBRatingClass; @@ -60,7 +60,7 @@ struct _RBRatingClass gboolean (*adjust_rating) (RBRating *rating, double adjust); }; -GtkType rb_rating_get_type (void); +GType rb_rating_get_type (void); RBRating *rb_rating_new (void);