]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkradiomenuitem.c
filechooserbutton: New test for opening the Other item in the combo box and then...
[~andy/gtk] / gtk / gtkradiomenuitem.c
index d64a3c428587818a0a7636c715c439301cee02a1..29011caa13c74677606ff8d96d2254fd32aa118d 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -95,7 +93,8 @@ G_DEFINE_TYPE (GtkRadioMenuItem, gtk_radio_menu_item, GTK_TYPE_CHECK_MENU_ITEM)
 
 /**
  * gtk_radio_menu_item_new:
- * @group: the group to which the radio menu item is to be attached
+ * @group: (element-type GtkRadioMenuItem): the group to which the
+ *    radio menu item is to be attached
  *
  * Creates a new #GtkRadioMenuItem.
  *
@@ -128,10 +127,9 @@ gtk_radio_menu_item_set_property (GObject      *object,
       GSList *slist;
 
     case PROP_GROUP:
-      if (G_VALUE_HOLDS_OBJECT (value))
-       slist = gtk_radio_menu_item_get_group ((GtkRadioMenuItem*) g_value_get_object (value));
-      else
-       slist = NULL;
+      slist = g_value_get_object (value);
+      if (slist)
+        slist = gtk_radio_menu_item_get_group ((GtkRadioMenuItem*) g_value_get_object (value));
       gtk_radio_menu_item_set_group (radio_menu_item, slist);
       break;
     default:
@@ -157,7 +155,7 @@ gtk_radio_menu_item_get_property (GObject    *object,
 /**
  * gtk_radio_menu_item_set_group:
  * @radio_menu_item: a #GtkRadioMenuItem.
- * @group: the new group.
+ * @group: (element-type GtkRadioMenuItem): the new group.
  *
  * Sets the group of a radio menu item, or changes it.
  */
@@ -250,24 +248,16 @@ GtkWidget*
 gtk_radio_menu_item_new_with_label (GSList *group,
                                    const gchar *label)
 {
-  GtkWidget *radio_menu_item;
-  GtkWidget *accel_label;
-
-  radio_menu_item = gtk_radio_menu_item_new (group);
-  accel_label = gtk_accel_label_new (label);
-  gtk_widget_set_halign (accel_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (accel_label, GTK_ALIGN_CENTER);
-  gtk_container_add (GTK_CONTAINER (radio_menu_item), accel_label);
-  gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), radio_menu_item);
-  gtk_widget_show (accel_label);
-
-  return radio_menu_item;
+  return g_object_new (GTK_TYPE_RADIO_MENU_ITEM,
+          "group", (group) ? group->data : NULL,
+          "label", label,
+          NULL);
 }
 
 
 /**
  * gtk_radio_menu_item_new_with_mnemonic:
- * @group: group the radio menu item is inside
+ * @group: (element-type GtkRadioMenuItem): group the radio menu item is inside
  * @label: the text of the button, with an underscore in front of the
  *         mnemonic character
  *
@@ -281,20 +271,11 @@ GtkWidget*
 gtk_radio_menu_item_new_with_mnemonic (GSList *group,
                                       const gchar *label)
 {
-  GtkWidget *radio_menu_item;
-  GtkWidget *accel_label;
-
-  radio_menu_item = gtk_radio_menu_item_new (group);
-  accel_label = g_object_new (GTK_TYPE_ACCEL_LABEL, NULL);
-  gtk_label_set_text_with_mnemonic (GTK_LABEL (accel_label), label);
-  gtk_widget_set_halign (accel_label, GTK_ALIGN_START);
-  gtk_widget_set_valign (accel_label, GTK_ALIGN_CENTER);
-
-  gtk_container_add (GTK_CONTAINER (radio_menu_item), accel_label);
-  gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (accel_label), radio_menu_item);
-  gtk_widget_show (accel_label);
-
-  return radio_menu_item;
+  return g_object_new (GTK_TYPE_RADIO_MENU_ITEM,
+          "group", (group) ? group->data : NULL,
+          "label", label,
+          "use-underline", TRUE,
+          NULL);
 }
 
 /**