Re: [Rhythmbox-devel] how to change menuitem name in thythmbox



hello,

in the top menubar of rhythmbox, there is a menuitem named play in control submenu. i want to change the name "play"  to "pause" when playing music, and rename it to "play"  when music is paused or stop.  i work on it for a long time, try so many says to fix it.but i cannot get the right way. please give me some idea how can i rename the menu. thank you very much.





At 2016-09-08 11:02:12, "宋啸寒" <iverhan 126 com> wrote:
dear all,

in file : rhythmbox/rhythmbox-3.0.2/data/ui/menubar.ui, there is a item named "_Play"  (in line 166), the "play" item in submenu "_Control"

in source file:  rhythmbox/rhythmbox-3.0.2/shell/rb-application.c line 443,there is  a function "static void impl_startup(GApplication *app)". this function will load the menubar.ui file create the top menu in rhythmbox. below is some codes in function impl_startup:

    /* only set the app menu if the shell shows it; otherwise, we'll
     * stick a menu button in the toolbar.
     */
    if (shell_shows_app_menu && !shell_shows_menubar) {
        gtk_application_set_app_menu (GTK_APPLICATION (app), menu);
    }
    else if (!shell_shows_app_menu || shell_shows_menubar) {
        GtkBuilder *menubar_builder;
        GMenuModel *menubar;

        menubar_builder = rb_builder_load ("menubar.ui", NULL);
        menubar = G_MENU_MODEL (gtk_builder_get_object (menubar_builder, "menubar"));
        rb_application_link_shared_menus (rb, G_MENU (menubar));
        gtk_application_set_menubar (GTK_APPLICATION (app), menubar);

        //add by myself*******************************************************
        GMenuModel *submenu = g_menu_model_get_item_link (menubar, 3, G_MENU_LINK_SUBMENU);//get the 4th submenu "_Control"
        GMenuModel *section = g_menu_model_get_item_link (submenu, 0, G_MENU_LINK_SECTION);  //get the 1st section, in this section there is a item called "_Play"
        //    now i want to get the item "_Play"  and change the word "_Play" to "_Pause".  i try almost all the function in devhelp,but i can't find the right one can change the word
        //     so, if anyone can give me some help,thank you very much    
        //end add*************************************************************

        g_object_unref (menubar_builder);
    }


i want to change the menuitem word dynamic,  but i can't get way to do that, anyone can give me some idea,thank you


 



 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]