summaryrefslogtreecommitdiff
path: root/plugins/gtkui/gtkui.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gtkui/gtkui.c')
-rw-r--r--plugins/gtkui/gtkui.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index c915558d..51fd3c52 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -77,7 +77,7 @@ int gtkui_embolden_current_track;
void
gtkpl_init (void) {
theme_treeview = gtk_tree_view_new ();
- GTK_WIDGET_UNSET_FLAGS (theme_treeview, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (theme_treeview, FALSE);
gtk_widget_show (theme_treeview);
GtkWidget *vbox1 = lookup_widget (mainwin, "vbox1");
gtk_box_pack_start (GTK_BOX (vbox1), theme_treeview, FALSE, FALSE, 0);
@@ -115,7 +115,7 @@ static struct timeval last_br_update;
static gboolean
update_songinfo (gpointer ctx) {
- int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED;
+ int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED;
if (!gtk_widget_get_visible (mainwin) || iconified) {
return FALSE;
}
@@ -216,7 +216,9 @@ update_songinfo (gpointer ctx) {
GtkWidget *widget = lookup_widget (mainwin, "seekbar");
// translate volume to seekbar pixels
songpos /= duration;
- songpos *= widget->allocation.width;
+ GtkAllocation a;
+ gtk_widget_get_allocation (widget, &a);
+ songpos *= a.width;
if (fabs (songpos - last_songpos) > 0.01) {
gtk_widget_queue_draw (widget);
last_songpos = songpos;
@@ -287,7 +289,7 @@ on_trayicon_scroll_event (GtkWidget *widget,
void
mainwin_toggle_visible (void) {
- int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED;
+ int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED;
if (gtk_widget_get_visible (mainwin) && !iconified) {
gtk_widget_hide (mainwin);
}
@@ -364,7 +366,7 @@ redraw_queued_tracks (DdbListview *pl, int list) {
static gboolean
redraw_queued_tracks_cb (gpointer nothing) {
- int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED;
+ int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED;
if (!gtk_widget_get_visible (mainwin) || iconified) {
return FALSE;
}
@@ -517,7 +519,7 @@ gtkui_on_frameupdate (gpointer data) {
static gboolean
gtkui_volumechanged_cb (gpointer ctx) {
GtkWidget *volumebar = lookup_widget (mainwin, "volumebar");
- gdk_window_invalidate_rect (volumebar->window, NULL, FALSE);
+ gdk_window_invalidate_rect (gtk_widget_get_window (volumebar), NULL, FALSE);
return FALSE;
}
@@ -905,7 +907,7 @@ update_win_title_idle (gpointer data) {
static gboolean
redraw_seekbar_cb (gpointer nothing) {
- int iconified = gdk_window_get_state(mainwin->window) & GDK_WINDOW_STATE_ICONIFIED;
+ int iconified = gdk_window_get_state(gtk_widget_get_window(mainwin)) & GDK_WINDOW_STATE_ICONIFIED;
if (!gtk_widget_get_visible (mainwin) || iconified) {
return FALSE;
}
@@ -948,7 +950,7 @@ gtkui_add_new_playlist (void) {
void
volumebar_redraw (void) {
GtkWidget *volumebar = lookup_widget (mainwin, "volumebar");
- gdk_window_invalidate_rect (volumebar->window, NULL, FALSE);
+ gdk_window_invalidate_rect (gtk_widget_get_window (volumebar), NULL, FALSE);
}
void
@@ -1331,11 +1333,19 @@ gtkui_get_mainwin (void) {
return mainwin;
}
+#if !GTK_CHECK_VERSION(3,0,0)
DB_plugin_t *
ddb_gui_GTK2_load (DB_functions_t *api) {
deadbeef = api;
return DB_PLUGIN (&plugin);
}
+#else
+DB_plugin_t *
+ddb_gui_GTK3_load (DB_functions_t *api) {
+ deadbeef = api;
+ return DB_PLUGIN (&plugin);
+}
+#endif
static const char settings_dlg[] =
"property \"Ask confirmation to delete files from disk\" checkbox gtkui.delete_files_ask 1;\n"