Unseal GtkAboutDialog's private_data member, convert from gpointer to GtkAboutDialogPrivate

This commit is contained in:
Cody Russell 2009-10-22 14:28:35 -05:00 committed by Javier Jardón
parent fb88f34e06
commit 03849dd358
2 changed files with 48 additions and 47 deletions

View File

@ -121,7 +121,6 @@
static GdkColor default_link_color = { 0, 0, 0, 0xeeee };
static GdkColor default_visited_link_color = { 0, 0x5555, 0x1a1a, 0x8b8b };
typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
struct _GtkAboutDialogPrivate
{
gchar *name;
@ -551,7 +550,7 @@ gtk_about_dialog_init (GtkAboutDialog *about)
/* Data */
priv = GTK_ABOUT_DIALOG_GET_PRIVATE (about);
about->private_data = priv;
about->priv = priv;
priv->name = NULL;
priv->version = NULL;
@ -663,7 +662,7 @@ static void
gtk_about_dialog_finalize (GObject *object)
{
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
g_free (priv->name);
g_free (priv->version);
@ -694,7 +693,7 @@ gtk_about_dialog_set_property (GObject *object,
GParamSpec *pspec)
{
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
switch (prop_id)
{
@ -753,7 +752,7 @@ gtk_about_dialog_get_property (GObject *object,
GParamSpec *pspec)
{
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
switch (prop_id)
{
@ -819,7 +818,7 @@ gtk_about_dialog_get_property (GObject *object,
static void
update_website (GtkAboutDialog *about)
{
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
gtk_widget_show (priv->website_label);
@ -882,7 +881,7 @@ gtk_about_dialog_get_program_name (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->name;
}
@ -893,7 +892,7 @@ update_name_version (GtkAboutDialog *about)
GtkAboutDialogPrivate *priv;
gchar *title_string, *name_string;
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
title_string = g_strdup_printf (_("About %s"), priv->name);
gtk_window_set_title (GTK_WINDOW (about), title_string);
@ -930,7 +929,7 @@ gtk_about_dialog_set_program_name (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->name;
priv->name = g_strdup (name ? name : g_get_application_name ());
g_free (tmp);
@ -959,7 +958,7 @@ gtk_about_dialog_get_version (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->version;
}
@ -982,7 +981,7 @@ gtk_about_dialog_set_version (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->version;
priv->version = g_strdup (version);
@ -1011,7 +1010,7 @@ gtk_about_dialog_get_copyright (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->copyright;
}
@ -1035,7 +1034,7 @@ gtk_about_dialog_set_copyright (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->copyright;
priv->copyright = g_strdup (copyright);
@ -1074,7 +1073,7 @@ gtk_about_dialog_get_comments (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->comments;
}
@ -1098,7 +1097,7 @@ gtk_about_dialog_set_comments (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->comments;
if (comments)
@ -1135,7 +1134,7 @@ gtk_about_dialog_get_license (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->license;
}
@ -1160,7 +1159,7 @@ gtk_about_dialog_set_license (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->license;
if (license)
@ -1196,7 +1195,7 @@ gtk_about_dialog_get_wrap_license (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), FALSE);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->wrap_license;
}
@ -1219,7 +1218,7 @@ gtk_about_dialog_set_wrap_license (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
wrap_license = wrap_license != FALSE;
@ -1249,7 +1248,7 @@ gtk_about_dialog_get_website (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->website_url;
}
@ -1275,7 +1274,7 @@ gtk_about_dialog_set_website (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->website_url;
priv->website_url = g_strdup (website);
@ -1304,7 +1303,7 @@ gtk_about_dialog_get_website_label (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->website_text;
}
@ -1328,7 +1327,7 @@ gtk_about_dialog_set_website_label (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->website_text;
priv->website_text = g_strdup (website_label);
@ -1359,7 +1358,7 @@ gtk_about_dialog_get_authors (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return (const gchar * const *) priv->authors;
}
@ -1367,7 +1366,7 @@ gtk_about_dialog_get_authors (GtkAboutDialog *about)
static void
update_credits_button_visibility (GtkAboutDialog *about)
{
GtkAboutDialogPrivate *priv = about->private_data;
GtkAboutDialogPrivate *priv = about->priv;
gboolean show;
show = priv->authors != NULL ||
@ -1401,7 +1400,7 @@ gtk_about_dialog_set_authors (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->authors;
priv->authors = g_strdupv ((gchar **)authors);
@ -1432,7 +1431,7 @@ gtk_about_dialog_get_documenters (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return (const gchar * const *)priv->documenters;
}
@ -1456,7 +1455,7 @@ gtk_about_dialog_set_documenters (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->documenters;
priv->documenters = g_strdupv ((gchar **)documenters);
@ -1487,7 +1486,7 @@ gtk_about_dialog_get_artists (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return (const gchar * const *)priv->artists;
}
@ -1511,7 +1510,7 @@ gtk_about_dialog_set_artists (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->artists;
priv->artists = g_strdupv ((gchar **)artists);
@ -1541,7 +1540,7 @@ gtk_about_dialog_get_translator_credits (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
return priv->translator_credits;
}
@ -1577,7 +1576,7 @@ gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
tmp = priv->translator_credits;
priv->translator_credits = g_strdup (translator_credits);
@ -1607,7 +1606,7 @@ gtk_about_dialog_get_logo (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_PIXBUF)
return gtk_image_get_pixbuf (GTK_IMAGE (priv->logo_image));
@ -1652,7 +1651,7 @@ gtk_about_dialog_set_logo (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
g_object_freeze_notify (G_OBJECT (about));
@ -1702,7 +1701,7 @@ gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about)
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_ICON_NAME)
gtk_image_get_icon_name (GTK_IMAGE (priv->logo_image), &icon_name, NULL);
@ -1729,7 +1728,7 @@ gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
priv = (GtkAboutDialogPrivate *)about->private_data;
priv = (GtkAboutDialogPrivate *)about->priv;
g_object_freeze_notify (G_OBJECT (about));
@ -1749,7 +1748,7 @@ follow_if_link (GtkAboutDialog *about,
GtkTextIter *iter)
{
GSList *tags = NULL, *tagp = NULL;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
gchar *url = NULL;
GtkAboutDialogActivateLinkFunc email_hook, url_hook;
gpointer email_hook_data, url_hook_data;
@ -1890,7 +1889,7 @@ set_cursor_if_appropriate (GtkAboutDialog *about,
gint x,
gint y)
{
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
GSList *tags = NULL, *tagp = NULL;
GtkTextIter iter;
gboolean hovering_over_link = FALSE;
@ -1979,7 +1978,8 @@ text_view_new (GtkAboutDialog *about,
GdkColor color;
GdkColor link_color;
GdkColor visited_link_color;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
linkify_email = (!activate_email_hook_set || activate_email_hook != NULL);
linkify_urls = (!activate_url_hook_set || activate_url_hook != NULL);
@ -2135,7 +2135,7 @@ display_credits_dialog (GtkWidget *button,
gpointer data)
{
GtkAboutDialog *about = (GtkAboutDialog *)data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
GtkWidget *dialog, *notebook;
GtkDialog *credits_dialog;
@ -2211,7 +2211,7 @@ display_license_dialog (GtkWidget *button,
gpointer data)
{
GtkAboutDialog *about = (GtkAboutDialog *)data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
GtkWidget *dialog, *view, *sw;
GtkDialog *licence_dialog;
gchar *strings[2];
@ -2358,7 +2358,7 @@ gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func,
static void
close_cb (GtkAboutDialog *about)
{
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->priv;
if (priv->license_dialog != NULL)
{

View File

@ -42,6 +42,7 @@ G_BEGIN_DECLS
typedef struct _GtkAboutDialog GtkAboutDialog;
typedef struct _GtkAboutDialogClass GtkAboutDialogClass;
typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
/**
* GtkAboutDialog:
@ -54,7 +55,7 @@ struct _GtkAboutDialog
GtkDialog parent_instance;
/*< private >*/
gpointer GSEAL (private_data);
GtkAboutDialogPrivate *priv;
};
struct _GtkAboutDialogClass