aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-01-23 03:28:42 +0800
committerDiego Escalante Urrelo <diegoe@gnome.org>2010-01-26 08:19:31 +0800
commit550e996a7a74974e16fe3301d0121ecf09acce37 (patch)
treeb24ceb2c84a219219c01eb99fab994acabdce863
parentadbf74706e0ee2295b9fec91ea6d017bf2c75edf (diff)
downloadgsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar.gz
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar.bz2
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar.lz
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar.xz
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.tar.zst
gsoc2013-epiphany-550e996a7a74974e16fe3301d0121ecf09acce37.zip
ephy-dialog: check if we get a valid EphyDialog
This API is public but we are not really good checking we get valid EphyDialog objects when called, add some checks. Bug #607802
-rw-r--r--lib/ephy-dialog.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index 210283699..1cdbe295d 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -1144,6 +1144,8 @@ void
ephy_dialog_set_modal (EphyDialog *dialog,
gboolean is_modal)
{
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
dialog->priv->modal = is_modal != FALSE;
gtk_window_set_modal (GTK_WINDOW(dialog->priv->dialog), is_modal);
@@ -1170,6 +1172,8 @@ ephy_dialog_add_enum (EphyDialog *dialog,
int i = 0;
GList *l = NULL;
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
info = lookup_info (dialog, property_id);
g_return_if_fail (info != NULL);
@@ -1197,6 +1201,8 @@ ephy_dialog_set_data_column (EphyDialog *dialog,
{
PropertyInfo *info;
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
info = lookup_info (dialog, property_id);
g_return_if_fail (info != NULL);
@@ -1219,6 +1225,8 @@ ephy_dialog_set_pref (EphyDialog *dialog,
{
PropertyInfo *info;
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
info = lookup_info (dialog, property_id);
g_return_if_fail (info != NULL);
@@ -1254,6 +1262,8 @@ ephy_dialog_set_size_group (EphyDialog *dialog,
GtkSizeGroup *size_group;
va_list vl;
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
va_start (vl, first_id);
@@ -1309,7 +1319,11 @@ ephy_dialog_construct (EphyDialog *dialog,
void
ephy_dialog_show (EphyDialog *dialog)
{
- EphyDialogClass *klass = EPHY_DIALOG_GET_CLASS (dialog);
+ EphyDialogClass *klass;
+
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
+ klass = EPHY_DIALOG_GET_CLASS (dialog);
klass->show (dialog);
}
@@ -1334,11 +1348,13 @@ ephy_dialog_hide (EphyDialog *dialog)
*
* Runs gtk_dialog_run on @dialog and waits for a response.
*
- * Returns: the user response to gtk_dialog_run
+ * Returns: the user response to gtk_dialog_run or 0 if @dialog is not valid
**/
int
ephy_dialog_run (EphyDialog *dialog)
{
+ g_return_val_if_fail (EPHY_IS_DIALOG (dialog), 0);
+
ephy_dialog_show (dialog);
gtk_window_group_add_window (ephy_gui_ensure_window_group (GTK_WINDOW (dialog->priv->parent)),
@@ -1354,6 +1370,7 @@ ephy_dialog_run (EphyDialog *dialog)
*
* Gets the internal widget corresponding to @property_id from @dialog.
* Return value: (transfer none): the #GtkWidget corresponding to @property_id
+ * or %NULL
**/
GtkWidget *
ephy_dialog_get_control (EphyDialog *dialog,
@@ -1361,6 +1378,8 @@ ephy_dialog_get_control (EphyDialog *dialog,
{
PropertyInfo *info;
+ g_return_val_if_fail (EPHY_IS_DIALOG (dialog), NULL);
+
info = lookup_info (dialog, property_id);
g_return_val_if_fail (info != NULL, NULL);
@@ -1421,6 +1440,8 @@ ephy_dialog_get_value (EphyDialog *dialog,
{
PropertyInfo *info;
+ g_return_val_if_fail (EPHY_IS_DIALOG (dialog), FALSE);
+
info = lookup_info (dialog, property_id);
g_return_val_if_fail (info != NULL, FALSE);
@@ -1442,6 +1463,8 @@ ephy_dialog_set_value (EphyDialog *dialog,
{
PropertyInfo *info;
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
info = lookup_info (dialog, property_id);
g_return_if_fail (info != NULL);
@@ -1528,6 +1551,8 @@ void
ephy_dialog_set_parent (EphyDialog *dialog,
GtkWidget *parent)
{
+ g_return_if_fail (EPHY_IS_DIALOG (dialog));
+
dialog->priv->parent = parent;
g_object_notify (G_OBJECT (dialog), "parent-window");