How to remove (or hide) Chat Status Icons from Messaging Menu

I would know how to remove or hide in Ubuntu 12.04 the Chat Status section (available, away, busy, invisible and offline) from Messaging Menu as I am not using any instant messenger. I do not want to remove the entire menu, just that section.

Thank you very much and best regards!!

Chat status section screenshot


FOR 12.04

If you're using 13.10 or newer see here..


Its possible...

pic

As you can see the status section has been removed leaving just the Broadcast and Mail sections

To put a positive spin - open-source means you have direct access to the actual source-code. You can interrogate and change the code ... as long as you give back the code changes to others!

So here goes - the following demonstrates the code changes that are required to the package indicator-messages

prerequisites

Lets get source packages from the repository:

sudo apt-get build-dep indicator-messages
apt-get source indicator-messages

This will create a folder - name will change depending upon the package version of indicator-messages. For 12.04 this folder is indicator-messages-0.6.0

code changes

Two modules in the folder indicator-messages-0.6.0 will need changing.

cd indicator-messages-0.6.0/src

status-items.c

Using your favourite editor add the line return NULL; at or around line 80 in the function "status_items_build" shown:

pic2

messages-service.c

At or around line 893 in the function "resort_menu" comment out the code shown with /* and */

pic3

lets compile

To compile this, move up to the parent folder

cd ..

Compile, make and install:

./configure
make
sudo make install

Logout and login.

to undo

To undo your changes:

cd indicator-messages-0.6.0
sudo make uninstall
sudo apt-get --reinstall install indicator-messages

For 13.10

If you're using for 12.04 see here.


Almost same steps in How to remove (or hide) Chat Status Icons from Messaging Menu

  • Install build prerequisites

    sudo apt-get build-dep indicator-messages
    
  • Download source archive

    apt-get source indicator-messages
    
  • Modify src/im-desktop-menu.c, add /* and */ to comment non needed menu as it is shown here:

    /*
    static GMenu *
    create_status_section (void)
    {
      GMenu *menu;
      GMenuItem *item;
    ...
        g_object_unref (item);
        return menu;
    }
    */
    
    /*
      {
        GMenu *status_section;
    
        status_section = create_status_section();
        im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (status_section));
    
        g_object_unref (status_section);
      }
    */
    

    To remove Clear menu item too:

    /*
      {
        GMenu *clear_section;
    
        clear_section = g_menu_new ();
        g_menu_append (clear_section, _("Clear"), "indicator.remove-all");
        im_menu_append_section (IM_MENU (menu), G_MENU_MODEL (clear_section));
    
        g_object_unref (clear_section);
      }
    */
    
  • Compile

    ./autogen.sh
    ./configure
    make
    
  • Install

    sudo make install
    

    Or like me I just replace it, without un-installing original (I use 64bit):

    Backup original

    sudo mv /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service_orig
    

    Copy the new compiled version

    sudo cp ./src/indicator-messages-service /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service_mod
    

    Create a link to the new compiled version

    sudo ln -s /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service_mod /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service
    

For 14.04

If you're using for 12.04 see here.

Same steps as 13.10 with different modifications


  • Modify src/im-desktop-menu.c, add /* and */ to comment non needed menu as it is shown here:

    /*
    static void
    menu_append_status (GMenu       *menu,
                                const gchar *label,
                        const gchar *detailed_action,
                        const gchar *icon_name)
    {
      GMenuItem *item;
      GIcon *icon;
    ...
    
      g_object_unref (icon);
      g_object_unref (item);
    }
    
    static void
    im_desktop_menu_show_chat_section (ImDesktopMenu *menu)
    {
              GMenu *status_section;
    ...
      menu->status_section_visible = TRUE;
    
      g_object_unref (status_section);
    }
    */
    ...
    
    /*
      if (g_desktop_app_info_get_boolean (app_info, "X-MessagingMenu-UsesChatSection"))
        im_desktop_menu_show_chat_section (menu);
    */