Пример #1
0
static MxAction *
_action_new_from_desktop_file (const gchar *desktop_file_id)
{
  GDesktopAppInfo *dai;

  dai = g_desktop_app_info_new (desktop_file_id);

  if (dai)
    {
      MxAction *action;
      GAppInfo *ai;
      GIcon *icon;

      ai = G_APP_INFO (dai);

      action = mx_action_new_full (g_app_info_get_name (ai),
                                   g_app_info_get_display_name (ai),
                                   G_CALLBACK (_app_launcher_cb),
                                   (gpointer)g_app_info_get_commandline (ai));

     icon = g_app_info_get_icon (ai);
     if (icon)
       {
         gchar *icon_name;
         icon_name =  g_icon_to_string (icon);

         mx_action_set_icon (action, icon_name);

         g_free (icon_name);
       }

      return action;
    }
  return NULL;
}
Пример #2
0
/**
 * mx_combo_box_insert_text_with_icon:
 * @box: A #MxComboBox
 * @position: zero indexed position to insert the item at
 * @text: name of the item
 * @icon: name of an icon from the icon theme
 *
 * Insert an item with text and an icon into the combo box list.
 *
 */
void
mx_combo_box_insert_text_with_icon (MxComboBox  *box,
                                    gint         position,
                                    const gchar *text,
                                    const gchar *icon)
{
  MxAction *action;

  g_return_if_fail (MX_IS_COMBO_BOX (box));

  action = mx_action_new ();
  mx_action_set_display_name (action, text);
  mx_action_set_icon (action, icon);

  box->priv->actions = g_slist_insert (box->priv->actions,
                                       g_object_ref_sink (action),
                                       position);
  mx_combo_box_update_menu (box);
}