* @short_description: An object that represents an application running in the Hildon framework.
* @see_also: #HildonWindow, #HildonStackableWindow
*
- * The #HildonProgram is an object used to represent an application running
+ * #HildonProgram is an object used to represent an application running
* in the Hildon framework.
*
- * Such an application is thought to have one or more #HildonWindow. These
- * shall be registered to the #HildonProgram with hildon_program_add_window(),
+ * Applications can have one or more #HildonWindow<!-- -->s. These
+ * can be registered in the #HildonProgram with hildon_program_add_window(),
* and can be unregistered similarly with hildon_program_remove_window().
*
- * The #HildonProgram provides the programmer with commodities such
- * as applying a common toolbar and menu to all the #HildonWindow
- * registered to it. This is done with hildon_program_set_common_menu()
- * and hildon_program_set_common_toolbar().
+ * #HildonProgram provides the programmer with commodities such
+ * as applying a common toolbar and menu to all registered
+ * #HildonWindow<!-- -->s. This is done with hildon_program_set_common_menu(),
+ * hildon_program_set_common_app_menu() and hildon_program_set_common_toolbar().
*
- * The #HildonProgram is also used to apply program-wide properties that
+ * #HildonProgram is also used to apply program-wide properties that
* are specific to the Hildon framework. For instance
* hildon_program_set_can_hibernate() sets whether or not an application
* can be set to hibernate by the Hildon task navigator, in situations of
* HildonWindow *window1;
* HildonWindow *window2;
* GtkToolbar *common_toolbar, *window_specific_toolbar;
- * GtkMenu *menu;
+ * HildonAppMenu *menu;
* <!-- -->
* program = HILDON_PROGRAM (hildon_program_get_instance ());
* <!-- -->
* hildon_program_add_window (program, window1);
* hildon_program_add_window (program, window2);
* <!-- -->
- * hildon_program_set_common_menu (program, menu);
+ * hildon_program_set_common_app_menu (program, menu);
* <!-- -->
* hildon_program_set_common_toolbar (program, common_toolbar);
* hildon_window_add_toolbar (window1, window_specific_toolbar);
* hildon_program_pop_window_stack:
* @self: A #HildonProgram
*
+ * Pops a window from the stack.
+ *
* Deprecated: Use hildon_window_stack_pop() instead
*
* Returns: A #HildonStackableWindow, or %NULL
static void
hildon_program_update_top_most (HildonProgram *program)
{
- XWMHints *wm_hints;
+ gboolean is_topmost;
Window active_window;
HildonProgramPrivate *priv;
g_assert (priv);
active_window = hildon_window_get_active_window();
+ is_topmost = FALSE;
if (active_window)
{
gint xerror;
+ XWMHints *wm_hints;
gdk_error_trap_push ();
wm_hints = XGetWMHints (GDK_DISPLAY (), active_window);
xerror = gdk_error_trap_pop ();
if (xerror)
+ {
+ if (wm_hints)
+ XFree (wm_hints);
return;
+ }
if (wm_hints)
{
-
- if (wm_hints->window_group == priv->window_group)
- {
- if (!priv->is_topmost)
- {
- priv->is_topmost = TRUE;
- g_object_notify (G_OBJECT (program), "is-topmost");
- }
- }
- else if (priv->is_topmost)
- {
- priv->is_topmost = FALSE;
- g_object_notify (G_OBJECT (program), "is-topmost");
- }
+ is_topmost = (wm_hints->window_group == priv->window_group);
+ XFree (wm_hints);
}
- XFree (wm_hints);
+ }
+
+ /* Send notification if is_topmost has changed */
+ if (!priv->is_topmost != !is_topmost)
+ {
+ priv->is_topmost = is_topmost;
+ g_object_notify (G_OBJECT (program), "is-topmost");
}
/* Check each window if it was is_topmost */
/**
* hildon_program_get_instance:
*
- * Return value: Returns the #HildonProgram for the current process.
- * The object is created on the first call. Note that you're not supposed
- * to unref the returned object since it's not reffed in the first place.
+ * Returns the #HildonProgram for the current process. The object is
+ * created on the first call. Note that you're not supposed to unref
+ * the returned object since it's not reffed in the first place.
+ *
+ * Return value: the #HildonProgram.
**/
HildonProgram*
hildon_program_get_instance (void)
*
* Registers a #HildonWindow as belonging to a given #HildonProgram. This
* allows to apply program-wide settings as all the registered windows,
- * such as hildon_program_set_common_menu() and
- * hildon_pogram_set_common_toolbar()
+ * such as hildon_program_set_common_menu(), hildon_program_set_common_app_menu()
+ * and hildon_program_set_common_toolbar().
**/
void
hildon_program_add_window (HildonProgram *self,
HildonProgramPrivate *priv;
g_return_if_fail (HILDON_IS_PROGRAM (self));
+ g_return_if_fail (HILDON_IS_WINDOW (window));
priv = HILDON_PROGRAM_GET_PRIVATE (self);
g_assert (priv);
/**
* hildon_program_remove_window:
* @self: The #HildonProgram to which the window should be unregistered
- * @window: The @HildonWindow to unregister
+ * @window: The #HildonWindow to unregister
*
* Used to unregister a window from the program. Subsequent calls to
- * hildon_program_set_common_menu() and hildon_pogram_set_common_toolbar()
- * will not affect the window
+ * hildon_program_set_common_menu(), hildon_program_set_common_app_menu()
+ * and hildon_program_set_common_toolbar() will not affect the window.
**/
void
hildon_program_remove_window (HildonProgram *self,
HildonProgramPrivate *priv;
g_return_if_fail (HILDON_IS_PROGRAM (self));
+ g_return_if_fail (HILDON_IS_WINDOW (window));
priv = HILDON_PROGRAM_GET_PRIVATE (self);
g_assert (priv);
+ g_return_if_fail (g_slist_find (priv->windows, window));
+
hildon_window_unset_program (window);
priv->windows = g_slist_remove (priv->windows, window);
/**
* hildon_program_get_can_hibernate:
* @self: The #HildonProgram which can hibernate or not
- *
- * Return value: Whether or not this #HildonProgram is set to be
- * support hibernation from the Hildon task navigator
+ *
+ * Returns whether the #HildonProgram is set to be support hibernation
+ * from the Hildon task navigator
+ *
+ * Return value: %TRUE if the program can hibernate, %FALSE otherwise.
**/
gboolean
hildon_program_get_can_hibernate (HildonProgram *self)
/**
* hildon_program_set_common_menu:
* @self: The #HildonProgram in which the common menu should be used
- * @menu: A GtkMenu to use as common menu for the program
+ * @menu: A #GtkMenu to use as common menu for the program
*
- * Sets a GtkMenu that will appear in all the #HildonWindow registered
- * with the #HildonProgram. Only one common GtkMenu can be set, further
- * calls will detach the previous common GtkMenu. A #HildonWindow
- * can use its own GtkMenu with hildon_window_set_menu()
+ * Sets a #GtkMenu that will appear in all #HildonWindow<!-- -->s
+ * registered with the #HildonProgram. Only one common #GtkMenu can be
+ * set, further calls will detach the previous common #GtkMenu. A
+ * #HildonWindow can use its own #GtkMenu with
+ * hildon_window_set_menu()
*
- * This method is not intented for #HildonStackableWindow<!-- -->s and
- * does not support #HildonAppMenu objects. See
+ * This method does not support #HildonAppMenu<!-- -->s. See
* hildon_program_set_common_app_menu() for that.
*
* Since: 2.2
{
if (GTK_WIDGET_VISIBLE (priv->common_menu))
{
- gtk_menu_popdown (GTK_MENU (priv->common_menu));
+ gtk_menu_popdown (priv->common_menu);
gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->common_menu));
}
- if (gtk_menu_get_attach_widget (GTK_MENU (priv->common_menu)))
+ if (gtk_menu_get_attach_widget (priv->common_menu))
{
- gtk_menu_detach (GTK_MENU (priv->common_menu));
+ gtk_menu_detach (priv->common_menu);
}
else
{
}
}
- priv->common_menu = GTK_WIDGET (menu);
+ priv->common_menu = menu;
if (priv->common_menu)
{
* hildon_program_get_common_menu:
* @self: The #HildonProgram from which to retrieve the common menu
*
- * Return value: the GtkMenu that was set as common menu for this
- * #HildonProgram, or %NULL of no common menu was set.
+ * Returns the #GtkMenu that was set as common menu for this
+ * #HildonProgram.
+ *
+ * Return value: the #GtkMenu or %NULL of no common menu was set.
**/
GtkMenu*
hildon_program_get_common_menu (HildonProgram *self)
priv = HILDON_PROGRAM_GET_PRIVATE (self);
g_assert (priv);
- return GTK_MENU (priv->common_menu);
+ return priv->common_menu;
}
/**
* @self: The #HildonProgram in which the common menu should be used
* @menu: A #HildonAppMenu to use as common menu for the program
*
- * Sets a #HildonAppMenu that will appear in all the
- * #HildonStackableWindow<!-- -->s registered with the
- * #HildonProgram. Only one common #HildonAppMenu can be set, further
- * calls will detach the previous common #HildonAppMenu. A
- * #HildonStackableWindow can use its own #HildonAppMenu with
- * hildon_stackable_window_set_main_menu()
+ * Sets a #HildonAppMenu that will appear in all
+ * #HildonWindow<!-- -->s registered with the #HildonProgram. Only
+ * one common #HildonAppMenu can be set, further calls will detach the
+ * previous common #HildonAppMenu. A #HildonWindow can use its own
+ * #HildonAppMenu with hildon_window_set_app_menu()
*
- * This method is not intented for standard #HildonWindow<!-- -->s and
- * does not support #GtkMenu objects. See
+ * This method does not support #GtkMenu<!-- -->s. See
* hildon_program_set_common_menu() for that.
*
* Since: 2.2
HildonAppMenu *menu)
{
HildonProgramPrivate *priv;
- GtkWidget *old_menu;
+ HildonAppMenu *old_menu;
g_return_if_fail (HILDON_IS_PROGRAM (self));
g_return_if_fail (menu == NULL || HILDON_IS_APP_MENU (menu));
old_menu = priv->common_app_menu;
/* Set new menu */
- priv->common_app_menu = GTK_WIDGET (menu);
+ priv->common_app_menu = menu;
if (menu)
g_object_ref_sink (menu);
/* Hide and unref old menu */
if (old_menu) {
- hildon_app_menu_set_parent_window (HILDON_APP_MENU (old_menu), NULL);
+ hildon_app_menu_set_parent_window (old_menu, NULL);
g_object_unref (old_menu);
}
}
* hildon_program_get_common_app_menu:
* @self: The #HildonProgram from which to retrieve the common app menu
*
- * Return value: the #HildonAppMenu that was set as common menu for this
- * #HildonProgram, or %NULL of no common app menu was set.
+ * Returns the #HildonAppMenu that was set as common menu for this
+ * #HildonProgram.
+ *
+ * Return value: the #HildonAppMenu or %NULL of no common app menu was
+ * set.
*
* Since: 2.2
**/
priv = HILDON_PROGRAM_GET_PRIVATE (self);
g_assert (priv);
- return HILDON_APP_MENU (priv->common_app_menu);
+ return priv->common_app_menu;
}
/**
* hildon_program_set_common_toolbar:
* @self: The #HildonProgram in which the common toolbar should be used
- * @toolbar: A GtkToolbar to use as common toolbar for the program
+ * @toolbar: A #GtkToolbar to use as common toolbar for the program
*
- * Sets a GtkToolbar that will appear in all the #HildonWindow registered
- * to the #HildonProgram. Only one common GtkToolbar can be set, further
- * call will detach the previous common GtkToolbar. A #HildonWindow
- * can use its own GtkToolbar with hildon_window_add_toolbar(). Both
+ * Sets a #GtkToolbar that will appear in all the #HildonWindow registered
+ * to the #HildonProgram. Only one common #GtkToolbar can be set, further
+ * call will detach the previous common #GtkToolbar. A #HildonWindow
+ * can use its own #GtkToolbar with hildon_window_add_toolbar(). Both
* #HildonProgram and #HildonWindow specific toolbars will be shown
**/
void
* hildon_program_get_common_toolbar:
* @self: The #HildonProgram from which to retrieve the common toolbar
*
- * Return value: the GtkToolbar that was set as common toolbar for this
- * #HildonProgram, or %NULL of no common menu was set.
+ * Returns the #GtkToolbar that was set as common toolbar for this
+ * #HildonProgram.
+ *
+ * Return value: the #GtkToolbar or %NULL of no common toolbar was
+ * set.
**/
GtkToolbar*
hildon_program_get_common_toolbar (HildonProgram *self)
* hildon_program_get_is_topmost:
* @self: A #HildonWindow
*
- * Return value: Whether or not one of the program's window or dialog is
- * currenltly activated by the window manager.
+ * Returns whether one of the program's windows or dialogs is
+ * currently activated by the window manager.
+ *
+ * Return value: %TRUE if a window or dialog is topmost, %FALSE
+ * otherwise.
**/
gboolean
hildon_program_get_is_topmost (HildonProgram *self)
* hildon_program_go_to_root_window:
* @self: A #HildonProgram
*
+ * Goes to the root window of the stack.
+ *
* Deprecated: See #HildonWindowStack
*/
void