}
static void
-onMainWindowSizeAllocated( GtkWidget * window,
+onMainWindowSizeAllocated( GtkWidget * gtk_window,
GtkAllocation * alloc UNUSED,
gpointer gdata UNUSED )
{
- const gboolean isMaximized = window->window
- && ( gdk_window_get_state( window->window )
- & GDK_WINDOW_STATE_MAXIMIZED );
+ GdkWindow * gdk_window = gtr_widget_get_window( gtk_window );
+ const gboolean isMaximized = ( gdk_window != NULL )
+ && ( gdk_window_get_state( gdk_window ) & GDK_WINDOW_STATE_MAXIMIZED );
gtr_pref_int_set( PREF_KEY_MAIN_WINDOW_IS_MAXIMIZED, isMaximized );
if( !isMaximized )
{
int x, y, w, h;
- gtk_window_get_position( GTK_WINDOW( window ), &x, &y );
- gtk_window_get_size( GTK_WINDOW( window ), &w, &h );
+ gtk_window_get_position( GTK_WINDOW( gtk_window ), &x, &y );
+ gtk_window_get_size( GTK_WINDOW( gtk_window ), &w, &h );
gtr_pref_int_set( PREF_KEY_MAIN_WINDOW_X, x );
gtr_pref_int_set( PREF_KEY_MAIN_WINDOW_Y, y );
gtr_pref_int_set( PREF_KEY_MAIN_WINDOW_WIDTH, w );
gint * height )
{
int w, h;
+ int xpad, ypad;
GdkRectangle icon_area;
GdkRectangle name_area;
GdkRectangle stat_area;
icon = get_icon( tor, COMPACT_ICON_SIZE, widget );
name = tr_torrentInfo( tor )->name;
status = getShortStatusString( tor, st, p->upload_speed_KBps, p->download_speed_KBps );
+ gtr_cell_renderer_get_padding( &cell->parent, &xpad, &ypad );
/* get the idealized cell dimensions */
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
#define BAR_WIDTH 50
if( width != NULL )
- *width = cell->parent.xpad * 2 + icon_area.width + GUI_PAD + name_area.width + GUI_PAD + BAR_WIDTH + GUI_PAD + stat_area.width;
+ *width = xpad * 2 + icon_area.width + GUI_PAD + name_area.width + GUI_PAD + BAR_WIDTH + GUI_PAD + stat_area.width;
if( height != NULL )
- *height = cell->parent.ypad * 2 + MAX( name_area.height, p->bar_height );
+ *height = ypad * 2 + MAX( name_area.height, p->bar_height );
/* cleanup */
g_free( status );
gint * height )
{
int w, h;
+ int xpad, ypad;
GdkRectangle icon_area;
GdkRectangle name_area;
GdkRectangle stat_area;
name = inf->name;
status = getStatusString( tor, st, p->upload_speed_KBps, p->download_speed_KBps );
progress = getProgressString( tor, inf, st );
+ gtr_cell_renderer_get_padding( &cell->parent, &xpad, &ypad );
/* get the idealized cell dimensions */
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
**/
if( width != NULL )
- *width = cell->parent.xpad * 2 + icon_area.width + GUI_PAD + MAX3( name_area.width, prog_area.width, stat_area.width );
+ *width = xpad * 2 + icon_area.width + GUI_PAD + MAX3( name_area.width, prog_area.width, stat_area.width );
if( height != NULL )
- *height = cell->parent.ypad * 2 + name_area.height + prog_area.height + GUI_PAD_SMALL + p->bar_height + GUI_PAD_SMALL + stat_area.height;
+ *height = ypad * 2 + name_area.height + prog_area.height + GUI_PAD_SMALL + p->bar_height + GUI_PAD_SMALL + stat_area.height;
/* cleanup */
g_free( status );
if( self && self->priv->tor )
{
- struct TorrentCellRendererPrivate * p = self->priv;
int w, h;
+ struct TorrentCellRendererPrivate * p = self->priv;
if( p->compact )
get_size_compact( TORRENT_CELL_RENDERER( cell ), widget, &w, &h );
if( x_offset )
*x_offset = cell_area ? cell_area->x : 0;
- if( y_offset )
- *y_offset = cell_area ? (int)((cell_area->height - (cell->ypad*2 +h)) / 2.0) : 0;
+ if( y_offset ) {
+ int xpad, ypad;
+ gtr_cell_renderer_get_padding( cell, &xpad, &ypad );
+ *y_offset = cell_area ? (int)((cell_area->height - (ypad*2 +h)) / 2.0) : 0;
+ }
}
}
GdkRectangle * expose_area UNUSED,
GtkCellRendererState flags )
{
+ int xpad, ypad;
GdkRectangle icon_area;
GdkRectangle name_area;
GdkRectangle stat_area;
icon = get_icon( tor, COMPACT_ICON_SIZE, widget );
name = tr_torrentInfo( tor )->name;
status = getShortStatusString( tor, st, p->upload_speed_KBps, p->download_speed_KBps );
+ gtr_cell_renderer_get_padding( &cell->parent, &xpad, &ypad );
fill_area = *background_area;
- fill_area.x += cell->parent.xpad;
- fill_area.y += cell->parent.ypad;
- fill_area.width -= cell->parent.xpad * 2;
- fill_area.height -= cell->parent.ypad * 2;
+ fill_area.x += xpad;
+ fill_area.y += ypad;
+ fill_area.width -= xpad * 2;
+ fill_area.height -= ypad * 2;
icon_area = name_area = stat_area = prog_area = fill_area;
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
GtkCellRendererState flags )
{
int w, h;
+ int xpad, ypad;
GdkRectangle fill_area;
GdkRectangle icon_area;
GdkRectangle name_area;
name = inf->name;
status = getStatusString( tor, st, p->upload_speed_KBps, p->download_speed_KBps );
progress = getProgressString( tor, inf, st );
+ gtr_cell_renderer_get_padding( &cell->parent, &xpad, &ypad );
/* get the idealized cell dimensions */
g_object_set( p->icon_renderer, "pixbuf", icon, NULL );
**/
fill_area = *background_area;
- fill_area.x += cell->parent.xpad;
- fill_area.y += cell->parent.ypad;
- fill_area.width -= cell->parent.xpad * 2;
- fill_area.height -= cell->parent.ypad * 2;
+ fill_area.x += xpad;
+ fill_area.y += ypad;
+ fill_area.width -= xpad * 2;
+ fill_area.height -= ypad * 2;
/* icon */
icon_area.x = fill_area.x;