else
{
expander = widget;
- bar = widget->parent;
+ bar = gtk_widget_get_parent(widget);
while (bar && !g_object_get_data(G_OBJECT(bar), "bar_data"))
- bar = bar->parent;
+ bar = gtk_widget_get_parent(bar);
if (!bar) return;
}
if (!pd) return;
- expander = pane->parent;
+ expander = gtk_widget_get_parent(pane);
gtk_expander_set_expanded(GTK_EXPANDER(expander), pd->expanded);
}
switch (info)
{
case TARGET_APP_EXIF_ENTRY:
- gtk_selection_data_set(selection_data, selection_data->target,
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
8, (gpointer) &entry, sizeof(entry));
break;
switch (info)
{
case TARGET_APP_EXIF_ENTRY:
- new_entry = *(gpointer *)selection_data->data;
+ new_entry = *(gpointer *)gtk_selection_data_get_data(selection_data);
- if (new_entry->parent && new_entry->parent != ped->vbox) bar_pane_exif_reparent_entry(new_entry, pane);
+ if (gtk_widget_get_parent(new_entry) && gtk_widget_get_parent(new_entry) != ped->vbox) bar_pane_exif_reparent_entry(new_entry, pane);
break;
default:
/* FIXME: this needs a check for valid exif keys */
- new_entry = bar_pane_exif_add_entry(ped, (gchar *)selection_data->data, NULL, TRUE, FALSE);
+ new_entry = bar_pane_exif_add_entry(ped, (gchar *)gtk_selection_data_get_data(selection_data), NULL, TRUE, FALSE);
break;
}
{
gint nx, ny;
GtkWidget *entry = work->data;
+ GtkAllocation allocation;
work = work->next;
if (entry == new_entry) continue;
+ gtk_widget_get_allocation(entry, &allocation);
+
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_is_drawable(entry) &&
#else
if (GTK_WIDGET_DRAWABLE(entry) &&
#endif
gtk_widget_translate_coordinates(pane, entry, x, y, &nx, &ny) &&
- ny < entry->allocation.height / 2) break;
+ ny < allocation.height / 2) break;
pos++;
}
g_list_free(list);
if (ee)
{
const gchar *title;
- GtkWidget *pane = cdd->widget->parent;
+ GtkWidget *pane = gtk_widget_get_parent(cdd->widget);
while (pane)
{
ped = g_object_get_data(G_OBJECT(pane), "pane_data");
if (ped) break;
- pane = pane->parent;
+ pane = gtk_widget_get_parent(pane);
}
if (!pane) return;
if (!phd->pixbuf) return TRUE;
- gdk_draw_pixbuf(widget->window,
-#if GTK_CHECK_VERSION(2,20,0)
- widget->style->fg_gc[gtk_widget_get_state(widget)],
-#else
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
-#endif
- phd->pixbuf,
- 0, 0,
- 0, 0,
- -1, -1,
- GDK_RGB_DITHER_NORMAL, 0, 0);
+ cairo_t *cr = gdk_cairo_create(gtk_widget_get_window(widget));
+ gdk_cairo_set_source_pixbuf (cr, phd->pixbuf, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);
+
return TRUE;
}
case TARGET_APP_KEYWORD_PATH:
{
GList *path = keyword_tree_get_path(keyword_tree, &child_iter);
- gtk_selection_data_set(selection_data, selection_data->target,
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
8, (gpointer) &path, sizeof(path));
break;
}
{
case TARGET_APP_KEYWORD_PATH:
{
- GList *path = *(gpointer *)selection_data->data;
+ GList *path = *(gpointer *)gtk_selection_data_get_data(selection_data);
src_valid = keyword_tree_get_iter(keyword_tree, &src_kw_iter, path);
string_list_free(path);
break;
}
default:
- new_keywords = string_to_keywords_list((gchar *)selection_data->data);
+ new_keywords = string_to_keywords_list((gchar *)gtk_selection_data_get_data(selection_data));
break;
}
gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0);
gtk_widget_show(label);
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0);
gtk_widget_show(combo);
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Collections"));
g_signal_connect(G_OBJECT(combo), "changed",
G_CALLBACK(bar_sort_mode_cb), sd);
gtk_widget_show(hbox);
cm->entry = gtk_entry_new();
- GTK_WIDGET_UNSET_FLAGS(cm->entry, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(cm->entry, FALSE);
gtk_editable_set_editable(GTK_EDITABLE(cm->entry), FALSE);
gtk_box_pack_start(GTK_BOX(hbox), cm->entry, TRUE, TRUE, 0);
gtk_widget_show(cm->entry);
hbox = pref_box_new(cd->gd->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
cd->progress = gtk_entry_new();
- GTK_WIDGET_UNSET_FLAGS(cd->progress, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(cd->progress, FALSE);
gtk_editable_set_editable(GTK_EDITABLE(cd->progress), FALSE);
gtk_entry_set_text(GTK_ENTRY(cd->progress), _("click start to begin"));
gtk_box_pack_start(GTK_BOX(hbox), cd->progress, TRUE, TRUE, 0);
gqv_cell_renderer_icon_init(GQvCellRendererIcon *cellicon)
{
GTK_CELL_RENDERER(cellicon)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
- GTK_CELL_RENDERER(cellicon)->xpad = 2;
- GTK_CELL_RENDERER(cellicon)->ypad = 2;
+ gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellicon), 2, 2);
}
static void
GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
gint calc_width;
gint calc_height;
+ gint xpad, ypad;
+ gint xalign, yalign;
+
+ gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
+ gtk_cell_renderer_get_alignment(cell, &xalign, &yalign);
if (cellicon->fixed_width > 0)
{
calc_width = MAX(calc_width, TOGGLE_SPACING * cellicon->num_marks);
}
- calc_width += (gint)cell->xpad * 2;
- calc_height += (gint)cell->ypad * 2;
+ calc_width += xpad * 2;
+ calc_height += ypad * 2;
if (x_offset) *x_offset = 0;
if (y_offset) *y_offset = 0;
{
if (x_offset)
{
- *x_offset = (cell->xalign * (cell_area->width - calc_width - 2 * cell->xpad));
- *x_offset = MAX(*x_offset, 0) + cell->xpad;
+ *x_offset = (xalign * (cell_area->width - calc_width - 2 * xpad));
+ *x_offset = MAX(*x_offset, 0) + xpad;
}
if (y_offset)
{
- *y_offset = (cell->yalign * (cell_area->height - calc_height - 2 * cell->ypad));
- *y_offset = MAX(*y_offset, 0) + cell->ypad;
+ *y_offset = (yalign * (cell_area->height - calc_height - 2 * ypad));
+ *y_offset = MAX(*y_offset, 0) + ypad;
}
}
const gchar *text;
GdkRectangle cell_rect;
GtkStateType state;
+ gint xpad, ypad;
+
pixbuf = cellicon->pixbuf;
text = cellicon->text;
if (!pixbuf && !text) return;
+ gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
+
gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
&cell_rect.x, &cell_rect.y,
&cell_rect.width, &cell_rect.height);
- cell_rect.x += cell->xpad;
- cell_rect.y += cell->ypad;
- cell_rect.width -= cell->xpad * 2;
- cell_rect.height -= cell->ypad * 2;
+ cell_rect.x += xpad;
+ cell_rect.y += ypad;
+ cell_rect.width -= xpad * 2;
+ cell_rect.height -= ypad * 2;
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
{
if (cellicon->fixed_height > 0)
{
- pix_rect.y = cell_area->y + cell->ypad + (cellicon->fixed_height - pix_rect.height) / 2;
+ pix_rect.y = cell_area->y + ypad + (cellicon->fixed_height - pix_rect.height) / 2;
}
else
{
pix_rect.width = text_rect.width;
pix_rect.height = text_rect.height;
- pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - text_rect.width + 1) / 2;
- pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - text_rect.height);
+ pix_rect.x = cell_area->x + xpad + (cell_rect.width - text_rect.width + 1) / 2;
+ pix_rect.y = cell_area->y + ypad + (cell_rect.height - text_rect.height);
if (cellicon->show_marks)
{
pix_rect.width = TOGGLE_SPACING * cellicon->num_marks;
pix_rect.height = TOGGLE_SPACING;
- pix_rect.x = cell_area->x + cell->xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
- pix_rect.y = cell_area->y + cell->ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
+ pix_rect.x = cell_area->x + xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
+ pix_rect.y = cell_area->y + ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect) &&
gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect))
GdkRectangle rect;
GdkRectangle cell_rect;
gint i;
+ gint xpad, ypad;
+
+ gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
&cell_rect.x, &cell_rect.y,
&cell_rect.width, &cell_rect.height);
- cell_rect.x += cell->xpad;
- cell_rect.y += cell->ypad;
- cell_rect.width -= cell->xpad * 2;
- cell_rect.height -= cell->ypad * 2;
+ cell_rect.x += xpad;
+ cell_rect.y += ypad;
+ cell_rect.width -= xpad * 2;
+ cell_rect.height -= ypad * 2;
rect.width = TOGGLE_WIDTH;
rect.height = TOGGLE_WIDTH;
- rect.y = cell_area->y + cell->ypad + (cell_rect.height - TOGGLE_SPACING) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
+ rect.y = cell_area->y + ypad + (cell_rect.height - TOGGLE_SPACING) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
for (i = 0; i < cellicon->num_marks; i++)
{
- rect.x = cell_area->x + cell->xpad + (cell_rect.width - TOGGLE_SPACING * cellicon->num_marks + 1) / 2 + i * TOGGLE_SPACING;
+ rect.x = cell_area->x + xpad + (cell_rect.width - TOGGLE_SPACING * cellicon->num_marks + 1) / 2 + i * TOGGLE_SPACING;
if (bevent->x >= rect.x && bevent->x < rect.x + rect.width &&
bevent->y >= rect.y && bevent->y < rect.y + rect.height)
static void collection_table_toggle_filenames(CollectTable *ct)
{
+ GtkAllocation allocation;
ct->show_text = !ct->show_text;
options->show_icon_names = ct->show_text;
- collection_table_populate_at_new_size(ct, ct->listview->allocation.width, ct->listview->allocation.height, TRUE);
+ gtk_widget_get_allocation(ct->listview, &allocation);
+ collection_table_populate_at_new_size(ct, allocation.width, allocation.height, TRUE);
}
static gint collection_table_get_icon_width(CollectTable *ct)
if (ct->tip_window) return;
- gdk_window_get_pointer(ct->listview->window, &x, &y, NULL);
+ gdk_window_get_pointer(gtk_widget_get_window(ct->listview), &x, &y, NULL);
ct->tip_info = collection_table_find_data_by_coord(ct, x, y, NULL);
if (!ct->tip_info) return;
gint ret;
adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(ct->listview));
- page_size = (gint)adj->page_increment;
+ page_size = (gint)gtk_adjustment_get_page_increment(adj);
row_height = options->thumbnails.max_height + THUMB_BORDER_PADDING * 2;
if (ct->show_text) row_height += options->thumbnails.max_height / 3;
store = gtk_tree_view_get_model(GTK_TREE_VIEW(ct->listview));
- if (!use_coord) gdk_window_get_pointer(ct->listview->window, &x, &y, NULL);
+ if (!use_coord) gdk_window_get_pointer(gtk_widget_get_window(ct->listview), &x, &y, NULL);
if (source)
{
gdk_pixbuf_render_pixmap_and_mask(pb, &pixmap, &mask, 128);
g_object_unref(pb);
- gdk_drawable_get_size(pixmap, &w, &h);
+ gdk_pixmap_get_size(pixmap, &w, &h);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
gint x, y;
gint w, h;
- gdk_drawable_get_size(ct->marker_window, &w, &h);
+ w = gdk_window_get_width(ct->marker_window);
+ h = gdk_window_get_height(ct->marker_window);
if (!after)
{
if (!ct->drop_idle_id) return FALSE;
- window = ct->listview->window;
+ window = gtk_widget_get_window(ct->listview);
gdk_window_get_pointer(window, &x, &y, NULL);
- gdk_drawable_get_size(window, &w, &h);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (x >= 0 && x < w && y >= 0 && y < h)
{
collection_table_motion_update(ct, x, y, TRUE);
break;
}
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, total);
+ gtk_selection_data_set_text(selection_data, uri_text, total);
g_free(uri_text);
}
CollectInfo *drop_info;
GList *work;
- DEBUG_1("%s", selection_data->data);
+ DEBUG_1("%s", gtk_selection_data_get_data(selection_data));
collection_table_scroll(ct, FALSE);
collection_table_insert_marker(ct, NULL, FALSE);
switch (info)
{
case TARGET_APP_COLLECTION_MEMBER:
- source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list);
+ source = collection_from_dnd_data((gchar *)gtk_selection_data_get_data(selection_data), &list, &info_list);
if (source)
{
if (source == ct->cd)
else
{
/* it is a move/copy across collections */
- if (context->action == GDK_ACTION_MOVE)
+ if (gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
collection_remove_by_info_list(source, info_list);
}
}
break;
case TARGET_URI_LIST:
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
work = list;
while (work)
{
static void collection_window_get_geometry(CollectWindow *cw)
{
CollectionData *cd;
+ GdkWindow *window;
if (!cw) return;
cd = cw->cd;
- gdk_window_get_position(cw->window->window, &cd->window_x, &cd->window_y);
- gdk_drawable_get_size(cw->window->window, &cd->window_w, &cd->window_h);
+ window = gtk_widget_get_window(cw->window);
+ gdk_window_get_position(window, &cd->window_x, &cd->window_y);
+ cd->window_w = gdk_window_get_width(window);
+ cd->window_h = gdk_window_get_height(window);
cd->window_read = TRUE;
}
ew->save_button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE,
G_CALLBACK(editor_window_save_cb), ew);
gtk_container_add(GTK_CONTAINER(button_hbox), ew->save_button);
- GTK_WIDGET_SET_FLAGS(ew->save_button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(ew->save_button, TRUE);
gtk_widget_set_sensitive(ew->save_button, FALSE);
gtk_widget_show(ew->save_button);
ct_button = ew->save_button;
button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
G_CALLBACK(editor_window_close_cb), ew);
gtk_container_add(GTK_CONTAINER(button_hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
if (!generic_dialog_get_alternative_button_order(ew->window))
button = pref_button_new(NULL, GTK_STOCK_NEW, NULL, FALSE,
G_CALLBACK(editor_list_window_new_cb), ewl);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_EDIT, NULL, FALSE,
G_CALLBACK(editor_list_window_edit_cb), ewl);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_set_sensitive(button, FALSE);
gtk_widget_show(button);
ewl->edit_button = button;
button = pref_button_new(NULL, GTK_STOCK_DELETE, NULL, FALSE,
G_CALLBACK(editor_list_window_delete_cb), ewl);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_set_sensitive(button, FALSE);
gtk_widget_show(button);
ewl->delete_button = button;
button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
G_CALLBACK(editor_list_window_close_cb), ewl);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
scrolled = gtk_scrolled_window_new(NULL, NULL);
void dnd_set_drag_icon(GtkWidget *widget, GdkDragContext *context, GdkPixbuf *pixbuf, gint items)
{
- GdkPixmap *pixmap;
- GdkBitmap *mask;
GdkPixbuf *dest;
gint w, h;
gint sw, sh;
pixbuf_draw_rect(dest, x, y, lw, lh, 128);
}
- gdk_pixbuf_render_pixmap_and_mask(dest, &pixmap, &mask, 128);
- g_object_unref(dest);
-
if (layout)
{
- gdk_draw_layout(pixmap, widget->style->black_gc, x+1, y+1, layout);
- gdk_draw_layout(pixmap, widget->style->white_gc, x, y, layout);
+ pixbuf_draw_layout(dest, layout, NULL, x+1, y+1, 0, 0, 0, 255);
+ pixbuf_draw_layout(dest, layout, NULL, x, y, 255, 255, 255, 255);
g_object_unref(G_OBJECT(layout));
}
- gtk_drag_set_icon_pixmap(context, gtk_widget_get_colormap(widget), pixmap, mask, -8, -6);
+ gtk_drag_set_icon_pixbuf(context, dest, -8, -6);
- g_object_unref(pixmap);
- if (mask) g_object_unref(mask);
+ g_object_unref(dest);
}
static void dnd_set_drag_label_end_cb(GtkWidget *widget, GdkDragContext *context, gpointer data)
{
GdkCursor *cursor;
- if (!widget->window) return;
+ if (!gtk_widget_get_window(widget)) return;
if (icon == -1)
{
cursor = gdk_cursor_new(icon);
}
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
if (cursor) gdk_cursor_unref(cursor);
}
{
DupeWindow *dw = data;
- dw->second_set = GTK_TOGGLE_BUTTON(widget)->active;
+ dw->second_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
if (dw->second_set)
{
{
DupeWindow *dw = data;
- dw->show_thumbs = GTK_TOGGLE_BUTTON(widget)->active;
+ dw->show_thumbs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
if (dw->show_thumbs)
{
break;
}
- if (uri_text) gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, length);
+ if (uri_text) gtk_selection_data_set_text(selection_data, uri_text, length);
g_free(uri_text);
}
switch (info)
{
case TARGET_APP_COLLECTION_MEMBER:
- collection_from_dnd_data((gchar *)selection_data->data, &list, NULL);
+ collection_from_dnd_data((gchar *)gtk_selection_data_get_data(selection_data), &list, NULL);
break;
case TARGET_URI_LIST:
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
work = list;
while (work)
{
static void clear_mouse_cursor(GtkWidget *widget, gint state)
{
- if (!widget->window) return;
+ GdkWindow *window = gtk_widget_get_window(widget);
+ if (!window) return;
if (state & FULLSCREEN_CURSOR_BUSY)
{
GdkCursor *cursor;
cursor = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(window, cursor);
gdk_cursor_unref(cursor);
}
else if (state & FULLSCREEN_CURSOR_NORMAL)
{
- gdk_window_set_cursor(widget->window, NULL);
+ gdk_window_set_cursor(window, NULL);
}
else
{
GdkCursor *cursor;
- GdkPixmap *p;
-
- p = gdk_bitmap_create_from_data(widget->window, "\0\0\0", 1, 1);
-
- cursor = gdk_cursor_new_from_pixmap(p, p,
- &widget->style->fg[GTK_STATE_ACTIVE],
- &widget->style->bg[GTK_STATE_ACTIVE],
- 0, 0);
-
- gdk_window_set_cursor(widget->window, cursor);
-
+
+ cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
+ gdk_window_set_cursor(window, cursor);
gdk_cursor_unref(cursor);
- g_object_unref(p);
}
}
if (height) *height = sd->height;
if (dest_screen) *dest_screen = screen;
- if (same_region) *same_region = (!widget || !widget->window ||
+ if (same_region) *same_region = (!widget || !gtk_widget_get_window(widget) ||
(screen == gtk_widget_get_screen(widget) &&
(sd->number%100 == 0 ||
- sd->number%100 == gdk_screen_get_monitor_at_window(screen, widget->window)+1)));
+ sd->number%100 == gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(widget))+1)));
}
- else if (screen != 1 || !widget || !widget->window)
+ else if (screen != 1 || !widget || !gtk_widget_get_window(widget))
{
GdkScreen *screen;
GdkRectangle rect;
screen = gtk_widget_get_screen(widget);
- monitor = gdk_screen_get_monitor_at_window(screen, widget->window);
+ monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(widget));
gdk_screen_get_monitor_geometry(screen, monitor, &rect);
gint monitor;
gint n;
- if (!widget || !widget->window) return 0;
+ if (!widget || !gtk_widget_get_window(widget)) return 0;
screen = gtk_widget_get_screen(widget);
- monitor = gdk_screen_get_monitor_at_window(screen, widget->window);
+ monitor = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(widget));
n = (gdk_screen_get_number(screen)+1) * 100 + monitor + 1;
GtkWidget *widget;
widget = imd->widget;
- if (!widget->window) return;
+ if (!gtk_widget_get_window(widget)) return;
+
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
if (has_focus)
{
- gtk_paint_focus(widget->style, widget->window, GTK_STATE_ACTIVE,
+ gtk_paint_focus(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_ACTIVE,
area, widget, "image_window",
- widget->allocation.x, widget->allocation.y,
- widget->allocation.width - 1, widget->allocation.height - 1);
+ allocation.x, allocation.y,
+ allocation.width - 1, allocation.height - 1);
}
else
{
- gtk_paint_shadow(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_IN,
+ gtk_paint_shadow(gtk_widget_get_style(widget), gtk_widget_get_window(widget), GTK_STATE_NORMAL, GTK_SHADOW_IN,
area, widget, "image_window",
- widget->allocation.x, widget->allocation.y,
- widget->allocation.width - 1, widget->allocation.height - 1);
+ allocation.x, allocation.y,
+ allocation.width - 1, allocation.height - 1);
}
}
{
ImageWindow *imd = data;
- GTK_WIDGET_SET_FLAGS(imd->widget, GTK_HAS_FOCUS);
+ gtk_widget_grab_focus(imd->widget);
image_focus_paint(imd, TRUE, NULL);
if (imd->func_focus_in)
{
ImageWindow *imd = data;
- GTK_WIDGET_UNSET_FLAGS(imd->widget, GTK_HAS_FOCUS);
+// GTK_WIDGET_UNSET_FLAGS(imd->widget, GTK_HAS_FOCUS);
image_focus_paint(imd, FALSE, NULL);
return TRUE;
gboolean selectable_frame_expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
- gtk_paint_flat_box(widget->style,
- widget->window,
- widget->state,
- (GTK_FRAME(widget))->shadow_type,
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(widget, &allocation);
+
+ gtk_paint_flat_box(gtk_widget_get_style(widget),
+ gtk_widget_get_window(widget),
+ gtk_widget_get_state(widget),
+ gtk_frame_get_shadow_type(GTK_FRAME(widget)),
NULL,
widget,
NULL,
- widget->allocation.x + 3, widget->allocation.y + 3,
- widget->allocation.width - 6, widget->allocation.height - 6);
+ allocation.x + 3, allocation.y + 3,
+ allocation.width - 6, allocation.height - 6);
return FALSE;
g_signal_connect(G_OBJECT(imd->frame), "expose_event",
G_CALLBACK(selectable_frame_expose_cb), NULL);
- GTK_WIDGET_SET_FLAGS(imd->frame, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(imd->frame, TRUE);
g_signal_connect(G_OBJECT(imd->frame), "focus_in_event",
G_CALLBACK(image_focus_in_cb), imd);
g_signal_connect(G_OBJECT(imd->frame), "focus_out_event",
ImageWindow *imd;
imd = view_window_active_image(vw);
- gdk_window_get_origin(imd->pr->window, x, y);
+ gdk_window_get_origin(gtk_widget_get_window(imd->pr), x, y);
popup_menu_position_clamp(menu, x, y, 0);
}
{
GList *work;
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
work = list;
while (work)
}
else
{
- source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list);
+ source = collection_from_dnd_data((gchar *)gtk_selection_data_get_data(selection_data), &list, &info_list);
}
if (list)
g_list_free(list);
if (text)
{
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)text, len);
+ gtk_selection_data_set_text(selection_data, text, len);
g_free(text);
}
}
else
{
- gtk_selection_data_set(selection_data, selection_data->target,
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
8, NULL, 0);
}
}
gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0);
gtk_widget_show(tabcomp);
- g_signal_connect(G_OBJECT(lw->path_entry->parent), "changed",
+ g_signal_connect(G_OBJECT(gtk_widget_get_parent(lw->path_entry)), "changed",
G_CALLBACK(layout_path_entry_changed_cb), lw);
lw->vd = vd_new(lw->options.dir_view_type, lw->dir_fd);
lw->sort_method = type;
lw->sort_ascend = ascend;
- if (lw->info_sort) gtk_label_set_text(GTK_LABEL(GTK_BIN(lw->info_sort)->child),
+ if (lw->info_sort) gtk_label_set_text(GTK_LABEL(gtk_bin_get_child(GTK_BIN(lw->info_sort))),
sort_type_get_text(type));
layout_list_sync_sort(lw);
}
gboolean layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h)
{
+ GdkWindow *window;
if (!layout_valid(&lw)) return FALSE;
-
- gdk_window_get_root_origin(lw->window->window, x, y);
- gdk_drawable_get_size(lw->window->window, w, h);
+
+ window = gtk_widget_get_window(lw->window);
+ gdk_window_get_root_origin(window, x, y);
+ *w = gdk_window_get_width(window);
+ *h = gdk_window_get_height(window);
return TRUE;
}
{
if (!layout_valid(&lw)) return FALSE;
- if (lw->h_pane && GTK_PANED(lw->h_pane)->child1->allocation.x >= 0)
+ if (lw->h_pane && gtk_paned_get_child1(GTK_PANED(lw->h_pane))->allocation.x >= 0)
{
- *h = GTK_PANED(lw->h_pane)->child1->allocation.width;
+ *h = gtk_paned_get_child1(GTK_PANED(lw->h_pane))->allocation.width;
}
else if (h != &lw->options.main_window.hdivider_pos)
{
*h = lw->options.main_window.hdivider_pos;
}
- if (lw->v_pane && GTK_PANED(lw->v_pane)->child1->allocation.x >= 0)
+ if (lw->v_pane && gtk_paned_get_child1(GTK_PANED(lw->v_pane))->allocation.x >= 0)
{
- *v = GTK_PANED(lw->v_pane)->child1->allocation.height;
+ *v = gtk_paned_get_child1(GTK_PANED(lw->v_pane))->allocation.height;
}
else if (v != &lw->options.main_window.vdivider_pos)
{
gboolean layout_geometry_get_tools(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h, gint *divider_pos)
{
+ GdkWindow *window;
if (!layout_valid(&lw)) return FALSE;
#if GTK_CHECK_VERSION(2,20,0)
return FALSE;
}
- gdk_window_get_root_origin(lw->tools->window, x, y);
- gdk_drawable_get_size(lw->tools->window, w, h);
+ window = gtk_widget_get_window(lw->window);
+ gdk_window_get_root_origin(window, x, y);
+ *w = gdk_window_get_width(window);
+ *h = gdk_window_get_height(window);
if (GTK_IS_VPANED(lw->tools_pane))
{
- *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.height;
+ *divider_pos = gtk_paned_get_child1(GTK_PANED(lw->tools_pane))->allocation.height;
}
else
{
- *divider_pos = GTK_PANED(lw->tools_pane)->child1->allocation.width;
+ *divider_pos = gtk_paned_get_child1(GTK_PANED(lw->tools_pane))->allocation.width;
}
return TRUE;
{
layout_tools_geometry_sync(lw);
/* dump the contents */
- gtk_widget_destroy(GTK_BIN(lw->tools)->child);
+ gtk_widget_destroy(gtk_bin_get_child(GTK_BIN(lw->tools)));
}
layout_actions_add_window(lw, lw->tools);
if (lw->split_images[i])
{
gtk_widget_hide(lw->split_images[i]->widget);
- if (lw->split_images[i]->widget->parent != lw->utility_paned)
- gtk_container_remove(GTK_CONTAINER(lw->split_images[i]->widget->parent), lw->split_images[i]->widget);
+ if (gtk_widget_get_parent(lw->split_images[i]->widget) != lw->utility_paned)
+ gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->split_images[i]->widget)), lw->split_images[i]->widget);
}
}
gtk_container_remove(GTK_CONTAINER(lw->utility_paned), lw->split_image_widget);
/* preserve utility_box (image + sidebars), menu_bar and toolbars to be reused later in layout_grid_setup */
/* lw->image is preserved together with lw->utility_box */
- if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(lw->utility_box->parent), lw->utility_box);
- if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(lw->menu_bar->parent), lw->menu_bar);
+ if (lw->utility_box) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->utility_box)), lw->utility_box);
+ if (lw->menu_bar) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->menu_bar)), lw->menu_bar);
for (i = 0; i < TOOLBAR_COUNT; i++)
- if (lw->toolbar[i]) gtk_container_remove(GTK_CONTAINER(lw->toolbar[i]->parent), lw->toolbar[i]);
+ if (lw->toolbar[i]) gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(lw->toolbar[i])), lw->toolbar[i]);
/* clear it all */
button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
G_CALLBACK(layout_config_ok_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_grab_default(button);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
G_CALLBACK(layout_config_apply_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE,
G_CALLBACK(layout_config_close_cb), lc);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
if (!generic_dialog_get_alternative_button_order(lc->configwindow))
button = gtk_button_new_with_label(text);
gtk_widget_set_sensitive(button, FALSE);
- GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(button, FALSE);
gtk_table_attach_defaults(GTK_TABLE(table), button, x1, x2, y1, y2);
gtk_widget_show(button);
}
if (info == TARGET_URI_LIST)
{
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
source = NULL;
info_list = NULL;
}
else
{
- source = collection_from_dnd_data((gchar *)selection_data->data, &list, &info_list);
+ source = collection_from_dnd_data((gchar *)gtk_selection_data_get_data(selection_data), &list, &info_list);
}
if (list)
g_list_free(list);
if (text)
{
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)text, len);
+ gtk_selection_data_set_text(selection_data, text, len);
g_free(text);
}
}
else
{
- gtk_selection_data_set(selection_data, selection_data->target,
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
8, NULL, 0);
}
}
static void layout_image_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)
{
LayoutWindow *lw = data;
- if (context->action == GDK_ACTION_MOVE)
+ if (gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
FileData *fd;
gint row;
memcpy(&logwin->colors[i], &logwin->colors[LOG_NORMAL], sizeof(GdkColor));
}
- colormap = gdk_drawable_get_colormap(logwin->window->window);
+ colormap = gdk_drawable_get_colormap(gtk_widget_get_window(logwin->window));
gdk_colormap_alloc_colors(colormap, logwin->colors, LOG_COUNT, FALSE, TRUE, success);
for (i = LOG_NORMAL; i < LOG_COUNT; i++)
init_exec_time();
/* setup locale, i18n */
- gtk_set_locale();
+ setlocale(LC_ALL, "");
#ifdef ENABLE_NLS
bindtextdomain(PACKAGE, GQ_LOCALEDIR);
gpointer submenu_item_get_data(GtkWidget *menu)
{
- if (!menu->parent || !GTK_IS_MENU(menu->parent)) return NULL;
+ if (!gtk_widget_get_parent(menu) || !GTK_IS_MENU(gtk_widget_get_parent(menu))) return NULL;
- return g_object_get_data(G_OBJECT(menu->parent), "submenu_data");
+ return g_object_get_data(G_OBJECT(gtk_widget_get_parent(menu)), "submenu_data");
}
/*
{
PanWindow *pw = data;
- gdk_window_get_origin(pw->imd->pr->window, x, y);
+ gdk_window_get_origin(gtk_widget_get_window(pw->imd->pr), x, y);
popup_menu_position_clamp(menu, x, y, 0);
}
pixbuf_renderer_get_image_size(pr, &width, &height);
adj = gtk_range_get_adjustment(GTK_RANGE(pw->scrollbar_h));
- adj->page_size = (gdouble)rect.width;
- adj->page_increment = adj->page_size / 2.0;
- adj->step_increment = 48.0 / pr->scale;
- adj->lower = 0.0;
- adj->upper = MAX((gdouble)width, 1.0);
- adj->value = (gdouble)rect.x;
+ gtk_adjustment_set_page_size(adj, rect.width);
+ gtk_adjustment_set_page_increment(adj, gtk_adjustment_get_page_size(adj) / 2.0);
+ gtk_adjustment_set_step_increment(adj, 48.0 / pr->scale);
+ gtk_adjustment_set_lower(adj, 0.0);
+ gtk_adjustment_set_upper(adj, MAX((gdouble)width, 1.0));
+ gtk_adjustment_set_value(adj, (gdouble)rect.x);
pref_signal_block_data(pw->scrollbar_h, pw);
gtk_adjustment_changed(adj);
pref_signal_unblock_data(pw->scrollbar_h, pw);
adj = gtk_range_get_adjustment(GTK_RANGE(pw->scrollbar_v));
- adj->page_size = (gdouble)rect.height;
- adj->page_increment = adj->page_size / 2.0;
- adj->step_increment = 48.0 / pr->scale;
- adj->lower = 0.0;
- adj->upper = MAX((gdouble)height, 1.0);
- adj->value = (gdouble)rect.y;
+ gtk_adjustment_set_page_size(adj, rect.height);
+ gtk_adjustment_set_page_increment(adj, gtk_adjustment_get_page_size(adj) / 2.0);
+ gtk_adjustment_set_step_increment(adj, 48.0 / pr->scale);
+ gtk_adjustment_set_lower(adj, 0.0);
+ gtk_adjustment_set_upper(adj, MAX((gdouble)height, 1.0));
+ gtk_adjustment_set_value(adj, (gdouble)rect.y);
pref_signal_block_data(pw->scrollbar_v, pw);
gtk_adjustment_changed(adj);
pref_label_new(box, _("Location:"));
combo = tab_completion_new_with_history(&pw->path_entry, dir_fd->path, "pan_view_path", -1,
pan_window_entry_activate_cb, pw);
- g_signal_connect(G_OBJECT(pw->path_entry->parent), "changed",
+ g_signal_connect(G_OBJECT(gtk_widget_get_parent(pw->path_entry)), "changed",
G_CALLBACK(pan_window_entry_change_cb), pw);
gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
gtk_widget_show(combo);
- combo = gtk_combo_box_new_text();
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Timeline"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Calendar"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders (flower)"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Grid"));
+ combo = gtk_combo_box_text_new();
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Timeline"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Calendar"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Folders (flower)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Grid"));
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), pw->layout);
g_signal_connect(G_OBJECT(combo), "changed",
gtk_box_pack_start(GTK_BOX(box), combo, FALSE, FALSE, 0);
gtk_widget_show(combo);
- combo = gtk_combo_box_new_text();
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Dots"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("No Images"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Small Thumbnails"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Normal Thumbnails"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Large Thumbnails"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("1:10 (10%)"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("1:4 (25%)"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("1:3 (33%)"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("1:2 (50%)"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("1:1 (100%)"));
+ combo = gtk_combo_box_text_new();
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Dots"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("No Images"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Small Thumbnails"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Normal Thumbnails"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Large Thumbnails"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:10 (10%)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:4 (25%)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:3 (33%)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:2 (50%)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("1:1 (100%)"));
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), pw->size);
g_signal_connect(G_OBJECT(combo), "changed",
{
GList *list;
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
if (list && isdir(((FileData *)list->data)->path))
{
FileData *fd = list->data;
g_list_free(list);
if (text)
{
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)text, len);
+ gtk_selection_data_set_text(selection_data, text, len);
g_free(text);
}
}
else
{
- gtk_selection_data_set(selection_data, selection_data->target,
+ gtk_selection_data_set(selection_data, gtk_selection_data_get_target(selection_data),
8, NULL, 0);
}
}
if (!GTK_WIDGET_NO_WINDOW(widget))
#endif
{
- if (event->window != widget->window)
+ if (event->window != gtk_widget_get_window(widget))
{
GdkRectangle area;
{
GdkCursor *cursor;
- if (!widget->window) return;
+ if (!gtk_widget_get_window(widget)) return;
if (icon == -1)
{
cursor = gdk_cursor_new(icon);
}
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
if (cursor) gdk_cursor_unref(cursor);
}
if (!pr->parent_window) return FALSE;
if (!pr->window_fit) return FALSE;
- if (!GTK_WIDGET(pr)->window) return FALSE;
+ if (!gtk_widget_get_window(GTK_WIDGET(pr))) return FALSE;
- if (!pr->parent_window->window) return FALSE;
- state = gdk_window_get_state(pr->parent_window->window);
+ if (!gtk_widget_get_window(pr->parent_window)) return FALSE;
+ state = gdk_window_get_state(gtk_widget_get_window(pr->parent_window));
if (state & GDK_WINDOW_STATE_MAXIMIZED) return FALSE;
return TRUE;
GtkWidget *widget;
GtkWidget *parent;
gint ww, wh;
+ GtkAllocation widget_allocation;
+ GtkAllocation parent_allocation;
if (!pr_parent_window_sizable(pr)) return FALSE;
widget = GTK_WIDGET(pr);
parent = GTK_WIDGET(pr->parent_window);
- w += (parent->allocation.width - widget->allocation.width);
- h += (parent->allocation.height - widget->allocation.height);
+ gtk_widget_get_allocation(widget, &widget_allocation);
+ gtk_widget_get_allocation(parent, &parent_allocation);
- gdk_drawable_get_size(parent->window, &ww, &wh);
+ w += (parent_allocation.width - widget_allocation.width);
+ h += (parent_allocation.height - widget_allocation.height);
+
+ ww = gdk_window_get_width(gtk_widget_get_window(parent));
+ wh = gdk_window_get_height(gtk_widget_get_window(parent));
if (w == ww && h == wh) return FALSE;
- gdk_window_resize(parent->window, w, h);
+ gdk_window_resize(gtk_widget_get_window(parent), w, h);
return TRUE;
}
pr->drag_last_x = bevent->x;
pr->drag_last_y = bevent->y;
pr->drag_moved = 0;
- gdk_pointer_grab(widget->window, FALSE,
+ gdk_pointer_grab(gtk_widget_get_window(widget), FALSE,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
gtk_grab_add(widget);
if (GTK_WIDGET_REALIZED(box))
#endif
{
- gdk_window_clear(box->window);
+ gdk_window_clear(gtk_widget_get_window(box));
pr->renderer->overlay_draw(pr->renderer, 0, 0, pr->viewport_width, pr->viewport_height);
if (pr->renderer2) pr->renderer2->overlay_draw(pr->renderer2, 0, 0, pr->viewport_width, pr->viewport_height);
}
gint x, gint y,
guint8 r, guint8 g, guint8 b, guint8 a)
{
- GdkPixmap *pixmap;
GdkPixbuf *buffer;
gint w, h;
GdkGC *gc;
gint sx, sy;
gint dw, dh;
-
- if (!widget || !widget->window) return;
+ cairo_surface_t *source;
+ cairo_t *cr;
pango_layout_get_pixel_size(layout, &w, &h);
if (w < 1 || h < 1) return;
- pixmap = gdk_pixmap_new(widget->window, w, h, -1);
-
- gc = gdk_gc_new(widget->window);
- gdk_gc_copy(gc, widget->style->black_gc);
- gdk_draw_rectangle(pixmap, gc, TRUE, 0, 0, w, h);
- gdk_gc_copy(gc, widget->style->white_gc);
- gdk_draw_layout(pixmap, gc, 0, 0, layout);
- g_object_unref(gc);
-
- buffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, w, h);
- gdk_pixbuf_get_from_drawable(buffer, pixmap,
- gdk_drawable_get_colormap(widget->window),
- 0, 0, 0, 0, w, h);
- g_object_unref(pixmap);
+ source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
+
+ cr = cairo_create (source);
+ cairo_set_source_rgb(cr, 0, 0, 0);
+ cairo_rectangle (cr, 0, 0, w, h);
+ cairo_fill (cr);
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ pango_cairo_show_layout (cr, layout);
+ cairo_destroy (cr);
+
+ buffer = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (source),
+ GDK_COLORSPACE_RGB,
+ cairo_image_surface_get_format (source) == CAIRO_FORMAT_ARGB32,
+ 8,
+ cairo_image_surface_get_width (source),
+ cairo_image_surface_get_height (source),
+ cairo_image_surface_get_stride (source),
+ NULL,
+ NULL);
sx = 0;
sy = 0;
r, g, b, a);
g_object_unref(buffer);
+ cairo_surface_destroy(source);
}
/*
static void zoom_mode_cb(GtkWidget *widget, gpointer data)
{
- if (GTK_TOGGLE_BUTTON (widget)->active)
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
c_options->image.zoom_mode = GPOINTER_TO_INT(data);
}
static void scroll_reset_cb(GtkWidget *widget, gpointer data)
{
- if (GTK_TOGGLE_BUTTON (widget)->active)
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
c_options->image.scroll_reset_method = GPOINTER_TO_INT(data);
}
pref_table_label(table, column, row, text, 0.0);
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Nearest (worst, but fastest)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Nearest (worst, but fastest)"));
if (option == GDK_INTERP_NEAREST) current = 0;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Tiles"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Tiles"));
if (option == GDK_INTERP_TILES) current = 1;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Bilinear"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Bilinear"));
if (option == GDK_INTERP_BILINEAR) current = 2;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Hyper (best, but slowest)"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Hyper (best, but slowest)"));
if (option == GDK_INTERP_HYPER) current = 3;
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), current);
pref_table_label(table, column, row, text, 0.0);
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
current = -1;
for (i = 0; (guint) i < sizeof(thumb_size_list) / sizeof(ThumbSize); i++)
h = thumb_size_list[i].h;
buf = g_strdup_printf("%d x %d", w, h);
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), buf);
g_free(buf);
if (w == options->thumbnails.max_width && h == options->thumbnails.max_height) current = i;
gchar *buf;
buf = g_strdup_printf("%s %d x %d", _("Custom"), options->thumbnails.max_width, options->thumbnails.max_height);
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), buf);
g_free(buf);
current = i;
pref_table_label(table, column, row, text, 0.0);
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Single image"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Single image"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Anaglyph Red-Cyan"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Red-Cyan"));
if (option & PR_STEREO_ANAGLYPH_RC) current = 1;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Anaglyph Gray Red-Cyan"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Gray Red-Cyan"));
if (option & PR_STEREO_ANAGLYPH_GRAY) current = 2;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Anaglyph Dubois"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Anaglyph Dubois"));
if (option & PR_STEREO_ANAGLYPH_DB) current = 3;
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Side by Side"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Side by Side Half size"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Side by Side"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Side by Side Half size"));
if (option & PR_STEREO_HORIZ)
{
current = 4;
if (option & PR_STEREO_HALF) current = 5;
}
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Top - Bottom"));
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Top - Bottom Half size"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Top - Bottom"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Top - Bottom Half size"));
if (option & PR_STEREO_VERT)
{
current = 6;
if (add_fixed)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Fixed position"));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _("Fixed position"));
if (option & PR_STEREO_FIXED) current = 8;
}
_("This will remove the trash contents."));
generic_dialog_add_button(gd, GTK_STOCK_OK, NULL, safe_delete_clear_ok_cb, TRUE);
entry = gtk_entry_new();
- GTK_WIDGET_UNSET_FLAGS(entry, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(entry, FALSE);
gtk_editable_set_editable(GTK_EDITABLE(entry), FALSE);
if (options->file_ops.safe_delete_path) gtk_entry_set_text(GTK_ENTRY(entry), options->file_ops.safe_delete_path);
gtk_box_pack_start(GTK_BOX(gd->vbox), entry, FALSE, FALSE, 0);
button = pref_button_new(NULL, GTK_STOCK_OK, NULL, FALSE,
G_CALLBACK(config_window_ok_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_grab_default(button);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_SAVE, NULL, FALSE,
G_CALLBACK(config_window_save_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_APPLY, NULL, FALSE,
G_CALLBACK(config_window_apply_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_CANCEL, NULL, FALSE,
G_CALLBACK(config_window_close_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
if (!generic_dialog_get_alternative_button_order(configwindow))
button = pref_button_new(NULL, NULL, _("Credits..."), FALSE,
G_CALLBACK(about_credits_cb), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_show(button);
button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
G_CALLBACK(about_window_close), NULL);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_grab_default(button);
gtk_widget_show(button);
GtkWidget *combo;
gint i;
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
for (i = 0 ; i < count; i++)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _(text[i]));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _(text[i]));
}
if (preferred >= 0 && preferred < count)
pref_table_label(table, column, row, (_("Format:")), 1.0);
- combo = gtk_combo_box_new_text();
+ combo = gtk_combo_box_text_new();
i = 0;
while (print_paper_sizes[i].description)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _(print_paper_sizes[i].description));
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), _(print_paper_sizes[i].description));
i++;
}
work = work->next;
buf = g_strdup_printf(PRINT_LPR_CUSTOM, name);
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), buf);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), buf);
g_free(buf);
}
string_list_free(list);
break;
}
- if (uri_text) gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, length);
+ if (uri_text) gtk_selection_data_set_text(selection_data, uri_text, length);
g_free(uri_text);
}
static void bookmark_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gint *pushed_in, gpointer data)
{
GtkWidget *button = data;
+ GtkAllocation allocation;
- gdk_window_get_origin(button->window, x, y);
- *y += button->allocation.y + button->allocation.height;
+ gtk_widget_set_allocation(button, &allocation);
+ gdk_window_get_origin(gtk_widget_get_window(button), x, y);
+ *y += allocation.y + allocation.height;
}
static void bookmark_menu_popup(BookMarkData *bm, GtkWidget *button,
gint length = 0;
GList *list = NULL;
- if (context->dest_window == bm->widget->window) return;
+// if (context->dest_window == bm->widget->window) return;
b = g_object_get_data(G_OBJECT(button), "bookbuttondata");
if (!b) return;
if (!uri_text) return;
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, length);
+ gtk_selection_data_set_text(selection_data, uri_text, length);
g_free(uri_text);
}
GdkPixbuf *pixbuf;
GdkModifierType mask;
gint x, y;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation(button, &allocation);
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
- button->allocation.width, button->allocation.height);
- gdk_pixbuf_get_from_drawable(pixbuf, button->window, NULL,
- button->allocation.x, button->allocation.y,
- 0, 0, button->allocation.width, button->allocation.height);
+ allocation.width, allocation.height);
+ gdk_pixbuf_get_from_drawable(pixbuf, gtk_widget_get_window(button), NULL,
+ allocation.x, allocation.y,
+ 0, 0, allocation.width, allocation.height);
- gdk_window_get_pointer(button->window, &x, &y, &mask);
+ gdk_window_get_pointer(gtk_widget_get_window(button), &x, &y, &mask);
gtk_drag_set_icon_pixbuf(context, pixbuf,
- x - button->allocation.x, y - button->allocation.y);
+ x - allocation.x, y - allocation.y);
g_object_unref(pixbuf);
}
{
case TARGET_URI_LIST:
case TARGET_X_URL:
- list = uri_list_from_text((gchar *)selection_data->data, FALSE);
+ list = uri_list_from_text((gchar *)gtk_selection_data_get_data(selection_data), FALSE);
break;
}
hc->history_key = g_strdup(history_key);
hc->history_levels = max_levels;
- hc->combo = gtk_combo_box_entry_new_text();
+ hc->combo = gtk_combo_box_text_new_with_entry();
#if 0
gtk_combo_set_case_sensitive(GTK_COMBO(hc->combo), TRUE);
gtk_combo_set_use_arrows(GTK_COMBO(hc->combo), FALSE);
#endif
- hc->entry = GTK_BIN(hc->combo)->child;
+ hc->entry = gtk_bin_get_child(GTK_BIN(hc->combo));
g_object_set_data(G_OBJECT(hc->combo), "history_combo_data", hc);
g_object_set_data(G_OBJECT(hc->entry), "history_combo_data", hc);
work = history_list_get_by_key(hc->history_key);
while (work)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(hc->combo), (gchar *)work->data);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(hc->combo), (gchar *)work->data);
work = work->next;
n++;
}
work = history_list_get_by_key(hc->history_key);
while (work)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(hc->combo), (gchar *)work->data);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(hc->combo), (gchar *)work->data);
work = work->next;
}
}
const gchar *bf;
/* check that gtk is initialized (loop is level > 0) */
- if (gtk_main_level() == 0)
- {
+// if (gtk_main_level() == 0)
+// {
/* gtk not initialized */
- gtk_init_add(encoding_dialog_delay, g_strdup(path));
- return;
- }
+// gtk_init_add(encoding_dialog_delay, g_strdup(path));
+// return;
+// }
if (warned_user) return;
warned_user = TRUE;
text = g_object_get_data(G_OBJECT(window), "text_widget");
if (!text) return;
- gdk_window_raise(window->window);
+ gdk_window_raise(gtk_widget_get_window(window));
if (key) help_window_scroll(text, key);
}
text = g_object_get_data(G_OBJECT(window), "text_widget");
if (!text) return;
- gdk_window_raise(window->window);
+ gdk_window_raise(gtk_widget_get_window(window));
help_window_load_text(text, path);
help_window_scroll(text, key);
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(help_window_close), window);
gtk_container_add(GTK_CONTAINER(hbox), button);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
gtk_widget_grab_default(button);
gtk_widget_show(button);
gboolean adjusted = FALSE;
gint w, h;
gint xw, xh;
+ GtkRequisition requisition;
- w = GTK_WIDGET(menu)->requisition.width;
- h = GTK_WIDGET(menu)->requisition.height;
+ gtk_widget_get_requisition(GTK_WIDGET(menu), &requisition);
+ w = requisition.width;
+ h = requisition.height;
xw = gdk_screen_width();
xh = gdk_screen_height();
vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
/* add additional spacing if necessary */
- if (GTK_IS_VBOX(parent_box) && GTK_BOX(parent_box)->children != NULL)
+ if (GTK_IS_VBOX(parent_box))
{
- pref_spacer(vbox, PREF_PAD_GROUP - PREF_PAD_GAP);
+ GList *list = gtk_container_get_children(GTK_CONTAINER(parent_box));
+ if (list)
+ {
+ pref_spacer(vbox, PREF_PAD_GROUP - PREF_PAD_GAP);
+ }
+ g_list_free(list);
}
gtk_box_pack_start(GTK_BOX(parent_box), vbox, fill, fill, 0);
gint x, y;
gint w, h;
gint xr, yr;
+ GdkWindow *window;
xr = (gint)event->x_root;
yr = (gint)event->y_root;
- gdk_window_get_origin(ds->window->window, &x, &y);
- gdk_drawable_get_size(ds->window->window, &w, &h);
+ window = gtk_widget_get_window(ds->window);
+ gdk_window_get_origin(window, &x, &y);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (xr < x || yr < y || xr > x + w || yr > y + h)
{
gint x, y;
gint wx, wy;
gint day, month, year;
+ GtkAllocation button_allocation;
+ GtkAllocation window_allocation;
if (ds->window) return;
gtk_widget_realize(ds->window);
- gdk_window_get_origin(ds->button->window, &wx, &wy);
+ gdk_window_get_origin(gtk_widget_get_window(ds->button), &wx, &wy);
- x = wx + ds->button->allocation.x + ds->button->allocation.width - ds->window->allocation.width;
- y = wy + ds->button->allocation.y + ds->button->allocation.height;
+ gtk_widget_get_allocation(ds->button, &button_allocation);
+ gtk_widget_get_allocation(ds->window, &window_allocation);
+
+ x = wx + button_allocation.x + button_allocation.width - window_allocation.width;
+ y = wy + button_allocation.y + button_allocation.height;
- if (y + ds->window->allocation.height > gdk_screen_height())
+ if (y + window_allocation.height > gdk_screen_height())
{
- y = wy + ds->button->allocation.y - ds->window->allocation.height;
+ y = wy + button_allocation.y - window_allocation.height;
}
if (x < 0) x = 0;
if (y < 0) y = 0;
gtk_widget_show(ds->window);
gtk_widget_grab_focus(ds->calendar);
- gdk_pointer_grab(ds->window->window, TRUE,
+ gdk_pointer_grab(gtk_widget_get_window(ds->window), TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
- gdk_keyboard_grab(ds->window->window, TRUE, GDK_CURRENT_TIME);
+ gdk_keyboard_grab(gtk_widget_get_window(ds->window), TRUE, GDK_CURRENT_TIME);
gtk_grab_add(ds->window);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ds->button), TRUE);
static void button_size_allocate_cb(GtkWidget *button, GtkAllocation *allocation, gpointer data)
{
GtkWidget *spin = data;
+ GtkRequisition spin_requisition;
+ gtk_widget_get_requisition(spin, &spin_requisition);
- if (allocation->height > spin->requisition.height)
+ if (allocation->height > spin_requisition.height)
{
GtkAllocation button_allocation;
+ GtkAllocation spin_allocation;
- button_allocation = button->allocation;
- button_allocation.height = spin->requisition.height;
- button_allocation.y = spin->allocation.y +
- (spin->allocation.height - spin->requisition.height) / 2;
+ gtk_widget_get_allocation(button, &button_allocation);
+ gtk_widget_get_allocation(spin, &spin_allocation);
+ button_allocation.height = spin_requisition.height;
+ button_allocation.y = spin_allocation.y +
+ (spin_allocation.height - spin_requisition.height) / 2;
gtk_widget_size_allocate(button, &button_allocation);
}
}
SizerData *sd = data;
gint x, y;
gint w, h;
+ GtkAllocation parent_allocation;
if (!sd->in_drag) return FALSE;
if (sd->bounding_widget)
{
- w = CLAMP(w, sd->sizer->allocation.width, sd->bounding_widget->allocation.width);
- h = CLAMP(h, sd->sizer->allocation.height, sd->bounding_widget->allocation.height);
+ GtkAllocation sizer_allocation;
+ GtkAllocation bounding_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+ gtk_widget_get_allocation(sd->bounding_widget, &bounding_allocation);
+ w = CLAMP(w, sizer_allocation.width, bounding_allocation.width);
+ h = CLAMP(h, sizer_allocation.height, bounding_allocation.height);
}
else
{
- if (w < sd->sizer->allocation.width) w = sd->sizer->allocation.width;
- if (h < sd->sizer->allocation.height) h = sd->sizer->allocation.height;
+ GtkAllocation sizer_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+ if (w < sizer_allocation.width) w = sizer_allocation.width;
+ if (h < sizer_allocation.height) h = sizer_allocation.height;
}
if (sd->hsize_max >= 0) w = MIN(w, sd->hsize_max);
if (sd->vsize_max >= 0) h = MIN(h, sd->vsize_max);
- if (w == sd->parent->allocation.width) w = -1;
- if (h == sd->parent->allocation.height) h = -1;
+ gtk_widget_get_allocation(sd->parent, &parent_allocation);
+ if (w == parent_allocation.width) w = -1;
+ if (h == parent_allocation.height) h = -1;
if (w > 0 || h > 0) gtk_widget_set_size_request(sd->parent, w, h);
static gboolean sizer_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
{
SizerData *sd = data;
+ GtkAllocation parent_allocation;
if (bevent->button != MOUSE_BUTTON_LEFT) return FALSE;
sd->press_x = bevent->x_root;
sd->press_y = bevent->y_root;
- sd->press_width = sd->parent->allocation.width;
- sd->press_height = sd->parent->allocation.height;
+ gtk_widget_get_allocation(sd->parent, &parent_allocation);
+ sd->press_width = parent_allocation.width;
+ sd->press_height = parent_allocation.height;
- gdk_pointer_grab(sd->sizer->window, FALSE,
+ gdk_pointer_grab(gtk_widget_get_window(sd->sizer), FALSE,
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
gtk_grab_add(sd->sizer);
static void sizer_set_prelight(SizerData *sd, gboolean prelit)
{
+ GtkAllocation sizer_allocation;
+ gtk_widget_get_allocation(sd->sizer, &sizer_allocation);
+
sd->handle_prelit = prelit;
gtk_widget_queue_draw_area(sd->sizer, 0, 0,
- sd->sizer->allocation.width, sd->sizer->allocation.height);
+ sizer_allocation.width, sizer_allocation.height);
}
static gboolean sizer_enter_cb(GtkWidget *widget, GdkEventCrossing *event, gpointer data)
GdkRectangle clip;
GtkOrientation orientation;
GtkStateType state;
+ GtkAllocation allocation;
gdk_region_get_clipbox(event->region, &clip);
}
else
{
- state = widget->state;
+ state = gtk_widget_get_state(widget);
}
- gtk_paint_handle(widget->style, widget->window, state,
+ gtk_widget_get_allocation(widget, &allocation);
+ gtk_paint_handle(gtk_widget_get_style(widget), gtk_widget_get_window(widget), state,
GTK_SHADOW_NONE, &clip, widget, "paned",
0, 0,
- widget->allocation.width, widget->allocation.height,
+ allocation.width, allocation.height,
orientation);
return TRUE;
n = (n != 0) ? GDK_FLEUR : GDK_SB_H_DOUBLE_ARROW;
}
- if (n != 0 && widget->window)
+ if (n != 0 && gtk_widget_get_window(widget))
{
GdkCursor *cursor;
cursor = gdk_cursor_new(n);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
gdk_cursor_unref(cursor);
}
}
if (!uri_text) return;
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, length);
+ gtk_selection_data_set_text(selection_data, uri_text, length);
g_free(uri_text);
}
if (!dd->filter_list || !dd->filter_combo) return;
- entry = GTK_BIN(dd->filter_combo)->child;
+ entry = gtk_bin_get_child(GTK_BIN(dd->filter_combo));
old_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(dd->filter_combo)));
}
dd->filter_text_list = uig_list_insert_link(dd->filter_text_list, g_list_last(dd->filter_text_list), buf);
- if (set) gtk_entry_set_text(GTK_ENTRY(GTK_BIN(dd->filter_combo)->child), filter);
+ if (set) gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dd->filter_combo))), filter);
dest_filter_list_sync(dd);
}
const gchar *buf;
gchar *path;
- entry = GTK_BIN(dd->filter_combo)->child;
+ entry = gtk_bin_get_child(GTK_BIN(dd->filter_combo));
buf = gtk_entry_get_text(GTK_ENTRY(entry));
g_free(dd->filter);
store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING);
- dd->filter_combo = gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(store),
- FILTER_COLUMN_FILTER);
+ dd->filter_combo = gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store));
g_object_unref(store);
gtk_cell_layout_clear(GTK_CELL_LAYOUT(dd->filter_combo));
renderer = gtk_cell_renderer_text_new();
dest_filter_clear(dd);
dest_filter_add(dd, filter, filter_desc, TRUE);
- dd->filter = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_BIN(dd->filter_combo)->child)));
+ dd->filter = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dd->filter_combo)))));
}
if (path && path[0] == G_DIR_SEPARATOR && isdir(path))
if (dd->filter_combo)
{
- g_signal_connect(G_OBJECT(GTK_BIN(dd->filter_combo)->child), "changed",
+ g_signal_connect(G_OBJECT(gtk_bin_get_child(GTK_BIN(dd->filter_combo))), "changed",
G_CALLBACK(dest_filter_changed_cb), dd);
}
g_signal_connect(G_OBJECT(dd->entry), "changed",
GdkScreen *screen;
gint monitor_num;
GdkRectangle monitor;
+ GtkRequisition requisition;
+ GtkAllocation allocation;
- gdk_window_get_origin(td->entry->window, x, y);
+ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(td->entry)), x, y);
screen = gtk_widget_get_screen(GTK_WIDGET(menu));
- monitor_num = gdk_screen_get_monitor_at_window(screen, td->entry->window);
+ monitor_num = gdk_screen_get_monitor_at_window(screen, gtk_widget_get_window(GTK_WIDGET(td->entry)));
gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
gtk_widget_size_request(GTK_WIDGET(menu), &req);
*x += strong_pos.x / PANGO_SCALE + xoffset;
- height = MIN(td->entry->requisition.height, td->entry->allocation.height);
+ gtk_widget_get_requisition(td->entry, &requisition);
+ gtk_widget_get_allocation(td->entry, &allocation);
+
+ height = MIN(requisition.height, allocation.height);
if (req.height > monitor.y + monitor.height - *y - height &&
*y - monitor.y > monitor.y + monitor.height - *y)
static void tab_completion_button_size_allocate(GtkWidget *button, GtkAllocation *allocation, gpointer data)
{
GtkWidget *parent = data;
+ GtkAllocation parent_allocation;
+ gtk_widget_get_allocation(parent, &parent_allocation);
- if (allocation->height > parent->allocation.height)
+ if (allocation->height > parent_allocation.height)
{
GtkAllocation button_allocation;
- button_allocation = button->allocation;
- button_allocation.height = parent->allocation.height;
- button_allocation.y = parent->allocation.y +
- (parent->allocation.height - parent->allocation.height) / 2;
+ gtk_widget_get_allocation(button, &button_allocation);
+ button_allocation.height = parent_allocation.height;
+ button_allocation.y = parent_allocation.y +
+ (parent_allocation.height - parent_allocation.height) / 2;
gtk_widget_size_allocate(button, &button_allocation);
}
}
GdkPixbuf *pixbuf;
button = gtk_button_new();
- GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus(button, FALSE);
g_signal_connect(G_OBJECT(button), "size_allocate",
G_CALLBACK(tab_completion_button_size_allocate), parent);
g_signal_connect(G_OBJECT(button), "clicked",
box = gtk_hbox_new(FALSE, 0);
- combo = gtk_combo_box_entry_new_text();
+ combo = gtk_combo_box_text_new_with_entry();
gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
gtk_widget_show(combo);
- combo_entry = GTK_BIN(combo)->child;
+ combo_entry = gtk_bin_get_child(GTK_BIN(combo));
#if 0
gtk_combo_set_case_sensitive(GTK_COMBO(combo), TRUE);
gtk_combo_set_use_arrows(GTK_COMBO(combo), FALSE);
work = history_list_get_by_key(history_key);
while (work)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(combo), (gchar *)work->data);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(combo), (gchar *)work->data);
work = work->next;
n++;
}
work = history_list_get_by_key(td->history_key);
while (work)
{
- gtk_combo_box_append_text(GTK_COMBO_BOX(td->combo), (gchar *)work->data);
+ gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(td->combo), (gchar *)work->data);
work = work->next;
n++;
}
static gboolean tree_edit_click_cb(GtkWidget *widget, GdkEventButton *event, gpointer data)
{
TreeEditData *ted = data;
+ GdkWindow *window = gtk_widget_get_window(ted->window);
gint x, y;
gint w, h;
xr = (gint)event->x_root;
yr = (gint)event->y_root;
- gdk_window_get_origin(ted->window->window, &x, &y);
- gdk_drawable_get_size(ted->window->window, &w, &h);
+ gdk_window_get_origin(window, &x, &y);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (xr < x || yr < y || xr > x + w || yr > y + h)
{
/* explicitely set the focus flag for the entry, for some reason on popup windows this
* is not set, and causes no edit cursor to appear ( popups not allowed focus? )
*/
- GTK_WIDGET_SET_FLAGS(ted->entry, GTK_HAS_FOCUS);
+ gtk_widget_grab_focus(ted->entry);
gtk_grab_add(ted->window);
- gdk_pointer_grab(ted->window->window, TRUE,
+ gdk_pointer_grab(gtk_widget_get_window(ted->window), TRUE,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
- gdk_keyboard_grab(ted->window->window, TRUE, GDK_CURRENT_TIME);
+ gdk_keyboard_grab(gtk_widget_get_window(ted->window), TRUE, GDK_CURRENT_TIME);
return FALSE;
}
if (!edit_func) return FALSE;
#if GTK_CHECK_VERSION(2,20,0)
- if (!gtk_widget_get_visible(tree)) return FALSE;
+ if (!gtk_widget_get_visible(GTK_WIDGET(tree))) return FALSE;
#else
if (!GTK_WIDGET_VISIBLE(tree)) return FALSE;
#endif
#else
gtk_tree_view_tree_to_widget_coords(widget, 0, 0, &x_offset, &y_offset);
#endif
- gdk_window_get_origin(GTK_WIDGET(widget)->window, &x_origin, &y_origin);
+ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(widget)), &x_origin, &y_origin);
if (gtk_tree_view_get_headers_visible(widget))
{
- header_size = tv_column->button->allocation.height;
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(tv_column->button, &allocation);
+ header_size = allocation.height;
}
else
{
gint wx, wy, ww, wh;
GdkWindow *window;
- window = GTK_WIDGET(widget)->window;
+ window = gtk_widget_get_window(GTK_WIDGET(widget));
gdk_window_get_origin(window, &wx, &wy);
- gdk_drawable_get_size(window, &ww, &wh);
+
+ ww = gdk_window_get_width(window);
+ wh = gdk_window_get_height(window);
+
if (!tree_view_get_cell_origin(widget, tpath, column, text_cell_only, x, y, width, height))
{
*x = wx;
sd->max_step = MIN(sd->region_size, sd->max_step + 2);
}
- window = sd->widget->window;
+ window = gtk_widget_get_window(sd->widget);
gdk_window_get_pointer(window, &x, &y, NULL);
- gdk_drawable_get_size(window, &w, &h);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (x < 0 || x >= w || y < 0 || y >= h)
{
{
amt = CLAMP(amt, 0 - sd->max_step, sd->max_step);
- if (sd->adj->value != CLAMP(sd->adj->value + amt, sd->adj->lower, sd->adj->upper - sd->adj->page_size))
+ if (gtk_adjustment_get_value(sd->adj) != CLAMP(gtk_adjustment_get_value(sd->adj) + amt, gtk_adjustment_get_lower(sd->adj), gtk_adjustment_get_upper(sd->adj) - gtk_adjustment_get_page_size(sd->adj)))
{
/* only notify when scrolling is needed */
if (sd->notify_func && !sd->notify_func(sd->widget, x, y, sd->notify_data))
}
gtk_adjustment_set_value(sd->adj,
- CLAMP(sd->adj->value + amt, sd->adj->lower, sd->adj->upper - sd->adj->page_size));
+ CLAMP(gtk_adjustment_get_value(sd->adj) + amt, gtk_adjustment_get_lower(sd->adj), gtk_adjustment_get_upper(sd->adj) - gtk_adjustment_get_page_size(sd->adj)));
}
}
button = pref_button_new(NULL, stock_id, text, FALSE,
G_CALLBACK(generic_dialog_click_cb), gd);
- GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+ gtk_widget_set_can_default(button, TRUE);
g_object_set_data(G_OBJECT(button), "dialog_function", func_cb);
gtk_container_add(GTK_CONTAINER(gd->hbox), button);
}
if (uritext)
{
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uritext, length);
+ gtk_selection_data_set_text(selection_data, uritext, length);
g_free(uritext);
}
}
vd_color_set(vd, vd->click_fd, FALSE);
- if (vd->type == DIRVIEW_LIST && context->action == GDK_ACTION_MOVE)
+ if (vd->type == DIRVIEW_LIST && gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
vd_refresh(vd);
}
gint active;
gboolean done = FALSE;
- list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
+ list = uri_filelist_from_text((gchar *)gtk_selection_data_get_data(selection_data), TRUE);
if (!list) return;
active = access_file(fd->path, W_OK | X_OK);
if (active)
{
- if (context->actions == GDK_ACTION_COPY)
+ if (gdk_drag_context_get_actions(context) == GDK_ACTION_COPY)
{
file_util_copy_simple(list, fd->path, vd->widget);
done = TRUE;
list = NULL;
}
- else if (context->actions == GDK_ACTION_MOVE)
+ else if (gdk_drag_context_get_actions(context) == GDK_ACTION_MOVE)
{
file_util_move_simple(list, fd->path, vd->widget);
done = TRUE;
gint x, y;
gint w, h;
- window = vd->view->window;
+ window = gtk_widget_get_window(vd->view);
gdk_window_get_pointer(window, &x, &y, NULL);
- gdk_drawable_get_size(window, &w, &h);
+ w = gdk_window_get_width(window);
+ h = gdk_window_get_height(window);
if (x >= 0 && x < w && y >= 0 && y < h)
{
vd_dnd_drop_update(vd, x, y);
}
else
{
- gdk_drag_status(context, context->suggested_action, time);
+ gdk_drag_status(context, gdk_drag_context_get_suggested_action(context), time);
}
vd_dnd_drop_update(vd, x, y);
{
GdkCursor *cursor = NULL;
- if (!widget || !widget->window) return;
+ if (!widget || !gtk_widget_get_window(widget)) return;
if (cursor_type > -1) cursor = gdk_cursor_new(cursor_type);
- gdk_window_set_cursor(widget->window, cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
if (cursor) gdk_cursor_unref(cursor);
gdk_flush();
}
static void vficon_toggle_filenames(ViewFile *vf)
{
+ GtkAllocation allocation;
VFICON(vf)->show_text = !VFICON(vf)->show_text;
options->show_icon_names = VFICON(vf)->show_text;
- vficon_populate_at_new_size(vf, vf->listview->allocation.width, vf->listview->allocation.height, TRUE);
+ gtk_widget_get_allocation(vf->listview, &allocation);
+ vficon_populate_at_new_size(vf, allocation.width, allocation.height, TRUE);
}
static gint vficon_get_icon_width(ViewFile *vf)
#else
if (GTK_WIDGET_SENSITIVE(window) &&
#endif
- GTK_WINDOW(window)->has_focus)
+ gtk_window_has_toplevel_focus(GTK_WINDOW(window)))
{
tip_show(vf);
}
DEBUG_1("%s", uri_text);
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, total);
+ gtk_selection_data_set_text(selection_data, uri_text, total);
g_free(uri_text);
}
if (id && id->fd) {
/* Add keywords to file */
FileData *fd = id->fd;
- gchar *str = g_strndup((gchar *)selection->data, selection->length);
+ gchar *str = gtk_selection_data_get_text(selection);
GList *kw_list = string_to_keywords_list(str);
metadata_append_list(fd, KEYWORD_KEY, kw_list);
vficon_selection_remove(vf, VFICON(vf)->click_id, SELECTION_PRELIGHT, NULL);
- if (context->action == GDK_ACTION_MOVE)
+ if (gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
vf_refresh(vf);
}
void vficon_marks_set(ViewFile *vf, gint enable)
{
- vficon_populate_at_new_size(vf, vf->listview->allocation.width, vf->listview->allocation.height, TRUE);
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(vf->listview, &allocation);
+ vficon_populate_at_new_size(vf, allocation.width, allocation.height, TRUE);
}
/*
gint ret;
adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vf->listview));
- page_size = (gint)adj->page_increment;
+ page_size = (gint)gtk_adjustment_get_page_increment(adj);
row_height = options->thumbnails.max_height + THUMB_BORDER_PADDING * 2;
if (VFICON(vf)->show_text) row_height += options->thumbnails.max_height / 3;
DEBUG_1("%s", uri_text);
- gtk_selection_data_set(selection_data, selection_data->target,
- 8, (guchar *)uri_text, total);
+ gtk_selection_data_set_text(selection_data, uri_text, total);
g_free(uri_text);
}
vflist_color_set(vf, VFLIST(vf)->click_fd, FALSE);
- if (context->action == GDK_ACTION_MOVE)
+ if (gdk_drag_context_get_selected_action(context) == GDK_ACTION_MOVE)
{
vf_refresh(vf);
}
if (fd) {
/* Add keywords to file */
- gchar *str = g_strndup((gchar *)selection->data, selection->length);
+ gchar *str = gtk_selection_data_get_text(selection);
GList *kw_list = string_to_keywords_list(str);
metadata_append_list(fd, KEYWORD_KEY, kw_list);
{
GdkWindowState state;
- if (!window || !window->window) return FALSE;
+ if (!window || !gtk_widget_get_window(window)) return FALSE;
- state = gdk_window_get_state(window->window);
+ state = gdk_window_get_state(gtk_widget_get_window(window));
return !!(state & GDK_WINDOW_STATE_MAXIMIZED);
}