/*# @method get_right_justified GtkMenuItem @brief Gets whether the menu item appears justified at the right side of the menu bar. @return TRUE if the menu item will appear at the far right if added to a menu bar. */ FALCON_FUNC MenuItem::get_right_justified( VMARG ) { NO_ARGS MYSELF; GET_OBJ( self ); vm->retval( (bool) gtk_menu_item_get_right_justified( (GtkMenuItem*)_obj ) ); }
int clip_GTK_MENUITEMGETRIGHTJUSTIFIED(ClipMachine * ClipMachineMemory) { C_widget *citm = _fetch_cw_arg(ClipMachineMemory); gboolean right_justified; CHECKCWID(citm, GTK_IS_ITEM); right_justified = gtk_menu_item_get_right_justified(GTK_MENU_ITEM(citm->widget)); _clip_retl(ClipMachineMemory, right_justified); return 0; err: return 1; }
/** * Toggle the visibility of conversation window menu items * * The method of hiding the menu items is to reparent them back into their * original (still hidden) parent window. This avoids conflicting with other * "hiding" methods used by plugins, such as widget sensitivity or visibility. * * When migrating to the Buddy List, left-justified items are inserted after * the last left-justified item. Right-justified items are inserted before the * first right-justified item. This appears to append conversation menu items * while keeping the Buddy List's notification icon on the far right. * * When migrating back to the conversation window, left-justified items are * prepended to all items. Right-justified items are inserted before the first * right-justified item. This gives the appearance of appending any newly * added menu items when they are all migrated to the Buddy List again. * * @param[in] gtkblist The Buddy List whose menu needs adjusting * @param[in] visible Whether the menu items are being shown or hidden **/ void pwm_set_conv_menus_visible(PidginBuddyList *gtkblist, gboolean visible) { PidginWindow * gtkconvwin; /*< Conversation window merged into gtkblist */ GtkMenu *submenu; /*< A submenu of a conversation menu item */ GtkContainer *from_menu; /*< Menu bar of the window losing the items */ GtkContainer *to_menu; /*< Menu bar of the window gaining the items */ GtkWidget *blist_menu; /*< The Buddy List menu bar */ GtkWidget *convs_menu; /*< The conversation window menu bar */ GtkWidget *item; /*< A menu item widget being transferred */ GList *children; /*< List of menu items in a given window */ GList *child; /*< A menu item in the list (iteration) */ GList *migrated_items; /*< List of items added to the Buddy List */ gint index_left; /*< Position to insert left-justified items */ gint index_right; /*< Position to insert right-justified items */ gtkconvwin = pwm_blist_get_convs(gtkblist); /* Sanity check: Only act on a merged Buddy List window. */ if (gtkconvwin == NULL) return; blist_menu = gtk_widget_get_parent(gtkblist->menutray); convs_menu = gtkconvwin->menu.menubar; from_menu = GTK_CONTAINER(visible ? convs_menu : blist_menu); to_menu = GTK_CONTAINER(visible ? blist_menu : convs_menu); migrated_items = pwm_fetch(gtkblist, "conv_menus"); /* XXX: Drop the "Send To" menu to avoid segfaults. */ if (visible && gtkconvwin->menu.send_to != NULL) { gtk_widget_destroy(gtkconvwin->menu.send_to); gtkconvwin->menu.send_to = NULL; } /* Locate the position before the first right-aligned menu item. */ index_right = 0; children = gtk_container_get_children(to_menu); for (child = children; child != NULL; child = child->next) if (gtk_menu_item_get_right_justified( GTK_MENU_ITEM(child->data))) break; else index_right++; g_list_free(children); index_left = visible ? index_right : 0; /* Loop over each conversation menu item to move it to its destination. */ children = visible ? gtk_container_get_children(from_menu) : migrated_items; for (child = children; child != NULL; child = child->next) { item = GTK_WIDGET(child->data); /* Reparent the item into the window based on existing justified * items. */ g_object_ref_sink(G_OBJECT(item)); gtk_container_remove(from_menu, item); if (gtk_menu_item_get_right_justified(GTK_MENU_ITEM(item))) gtk_menu_shell_insert(GTK_MENU_SHELL(to_menu), item, index_right); else gtk_menu_shell_insert(GTK_MENU_SHELL(to_menu), item, index_left++); g_object_unref(G_OBJECT(item)); index_right++; /* Register/Unregister its accelerator group with the Buddy List * window. */ submenu = GTK_MENU(gtk_menu_item_get_submenu(GTK_MENU_ITEM(item))); if (visible) gtk_window_add_accel_group( GTK_WINDOW(gtkblist->window), gtk_menu_get_accel_group(submenu)); else gtk_window_remove_accel_group( GTK_WINDOW(gtkblist->window), gtk_menu_get_accel_group(submenu)); /* Add this menu item to the list for later restoration, if * necessary. */ if (visible) migrated_items = g_list_append(migrated_items, child->data); } g_list_free(children); /* Update the stored pointer to the list of migrated items. */ if (visible) pwm_store(gtkblist, "conv_menus", migrated_items); else pwm_clear(gtkblist, "conv_menus"); }
static VALUE mitem_get_right_justified(VALUE self) { return CBOOL2RVAL(gtk_menu_item_get_right_justified(_SELF(self))); }