*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
GtkTreeView *tree_view = GTK_TREE_VIEW (user_data);
GtkWidget *widget = GTK_WIDGET (user_data);
GtkRequisition req;
+ GtkAllocation allocation;
GdkRectangle visible;
gtk_widget_size_request (GTK_WIDGET (menu), &req);
- gdk_window_get_origin (widget->window, x, y);
+ gdk_window_get_origin (gtk_widget_get_window (widget), x, y);
+ gtk_widget_get_allocation (widget, &allocation);
- *x += (widget->allocation.width - req.width) / 2;
+ *x += (allocation.width - req.width) / 2;
/* Add on height for the treeview title */
gtk_tree_view_get_visible_rect (tree_view, &visible);
- *y += widget->allocation.height - visible.height;
+ *y += allocation.height - visible.height;
selection = gtk_tree_view_get_selection (tree_view);
selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
return gdk_screen_get_n_monitors (screen);
}
-gdouble
-get_screen_dpi (GtkWindow *window)
-{
- GdkScreen *screen;
- gdouble xdpi, ydpi;
-
- screen = gtk_window_get_screen (window);
-
- xdpi = 25.4 * gdk_screen_get_width (screen) / gdk_screen_get_width_mm (screen);
- ydpi = 25.4 * gdk_screen_get_height (screen) / gdk_screen_get_height_mm (screen);
-
- return (xdpi + ydpi) / 2.0;
-}
-
-
void
file_chooser_dialog_add_writable_pixbuf_formats (GtkFileChooser *chooser)
{
g_slist_free (pixbuf_formats);
return NULL;
}
-
-#define XDIGIT(c) ((c) <= '9' ? (c) - '0' : ((c) & 0x4F) - 'A' + 10)
-#define HEXCHAR(s) ((XDIGIT (s[1]) << 4) + XDIGIT (s[2]))
-
-static char *
-uri_decoded_copy (const char *part, int length)
-{
- unsigned char *s, *d;
- char *decoded = g_strndup (part, length);
-
- s = d = (unsigned char *)decoded;
- do {
- if (*s == '%') {
- if (!g_ascii_isxdigit (s[1]) ||
- !g_ascii_isxdigit (s[2])) {
- g_free (decoded);
- return NULL;
- }
- *d++ = HEXCHAR (s);
- s += 2;
- } else
- *d++ = *s;
- } while (*s++);
-
- return decoded;
-}
-
-char* escape_uri_for_display (const char *uri)
-{
- GFile *file;
- char *disp;
- char *filename;
-
- file = g_file_new_for_uri (uri);
- filename = g_file_get_parse_name (file);
- disp = uri_decoded_copy (filename, strlen (filename));
- g_free (filename);
- g_object_unref (file);
-
- return disp;
-}