int device_perform_action(int which) {
	if(which==0) {
		dualboot_show_selection_ui();
		update_menu_items();
		dualboot_setup_env();
	}

    return which-1;
}
示例#2
0
文件: proj.c 项目: juddy/edcde
/*
 * Action: Toggle select module in project window
 */
static void
toggle_select_module(
    Widget widget, 
    XEvent *event, 
    String *params, 
    int num_params
)
{
    Vwr		v = NULL;
    VNode	selected_node;
    VMethods	m;
    AB_OBJ	*obj;

    XtVaGetValues(widget, XmNuserData, &v, NULL); 

    if (!v)
	return;

    selected_node = vwr_locate_node(v, 
		        event->xbutton.x, event->xbutton.y);
    
    if (selected_node)
    {
	VNode	*selected_nodes = NULL;
	int	num_selected = 0;

	if (!(m = v->methods))
	    return;
	
	/* USE METHODS !! */
	obj = (AB_OBJ *)selected_node->obj_data;

	if (!obj)
	    return;

	/*
	 * Toggle select the module node
	 */
        if (BRWS_NODE_STATE_IS_SET(selected_node, BRWS_NODE_SELECTED))
	    proj_deselect(obj);
	else
	    proj_select(obj);

        vwr_get_cond(v->current_tree, &selected_nodes, 
			&num_selected, select_fn);
	
	if (selected_nodes)
	    free((char *)selected_nodes);

	update_menu_items(0, num_selected);
    }
}
示例#3
0
文件: proj.c 项目: juddy/edcde
/*
 * Action: Select module in project window
 */
static void
select_module(
    Widget widget, 
    XEvent *event, 
    String *params, 
    int num_params
)
{
    Vwr		v = NULL;
    VNode	selected_node;
    VMethods	m;
    AB_OBJ	*obj;

    XtVaGetValues(widget, XmNuserData, &v, NULL); 

    if (!v)
	return;

    selected_node = vwr_locate_node(v, 
		        event->xbutton.x, event->xbutton.y);
    
    if (selected_node)
    {
	VNode	*selected_nodes = NULL;
	int	num_selected = 0;

	if (!(m = v->methods))
	    return;
	
	/* USE METHODS !! */
	obj = (AB_OBJ *)selected_node->obj_data;

	if (!obj)
	    return;

	/*
	 * Deselect all selected module nodes
	 * Select the module node
	 */
	aob_deselect_all_nodes(v, TRUE);
	proj_select(obj);

        vwr_get_cond(v->current_tree, &selected_nodes, 
			&num_selected, select_fn);
	
	if (selected_nodes)
	    free((char *)selected_nodes);

	update_menu_items(0, num_selected);
    }
}
示例#4
0
文件: proj.c 项目: juddy/edcde
/*
 * Popup the project window by managing the container child of the
 * Dialog shell.
 */
void
proj_show_dialog()
{
    ABObj		proj = proj_get_project();
    BrowserUiObj 	ui;
    ChooserInfo		info = NULL;
 
    if (AB_proj_window == NULL)
    {
	if (!Proj_viewer)
            Proj_viewer = create_proj_struct();

	create_proj_ui_handles(Proj_viewer);
        proj_add_objects(proj);

	/* Check if the shared file chooser is already
	 * up when the Project Organizer is displayed.
	 * If it is, then find out which one is up and
	 * set the appropriate menu items inactive.
	 */
	if ((AB_generic_chooser != NULL) &&
	    XtIsManaged(AB_generic_chooser))
 	{
	    XtVaGetValues(AB_generic_chooser,
				XmNuserData, &info,
				NULL);
	    proj_set_menus(info->chooser_type, FALSE);
	}
	/* When the Project Organizer is first brought
	 * up, no modules are selected so certain menu
	 * items (like Module ->Save/Save As) should be
	 * made inactive.
	 */
	update_menu_items(0, 0);
    }
    ab_show_window(AB_proj_window);
    abobj_update_proj_name( proj );
}
示例#5
0
static void device_changed (GtkTreeModel *model,
			     GtkTreePath  *path,
			     GtkTreeIter  *_iter,
			     gpointer      data)
{
	GtkTreeIter iter, *default_iter;
	gboolean powered, cont;

	default_iter = NULL;
	num_adapters_present = num_adapters_powered = 0;

	cont = gtk_tree_model_get_iter_first (model, &iter);
	while (cont) {
		gboolean is_default;

		num_adapters_present++;

		gtk_tree_model_get (model, &iter,
				    BLUETOOTH_COLUMN_DEFAULT, &is_default,
				    BLUETOOTH_COLUMN_POWERED, &powered,
				    -1);
		if (powered)
			num_adapters_powered++;
		if (is_default && powered)
			default_iter = gtk_tree_iter_copy (&iter);

		cont = gtk_tree_model_iter_next (model, &iter);
	}

	update_discoverability (default_iter);
	update_icon_visibility ();
	update_menu_items ();
	update_device_list (default_iter);

	if (default_iter != NULL)
		gtk_tree_iter_free (default_iter);
}
示例#6
0
int main(int argc, char *argv[])
{
	GApplication *app;
#ifdef HAVE_APP_INDICATOR
	AppIndicator *indicator;
#else
	GtkStatusIcon *statusicon;
#endif /* HAVE_APP_INDICATOR */
	GtkWidget *menu;
	GOptionContext *context;
	GError *error = NULL;

	bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
	textdomain(GETTEXT_PACKAGE);

	g_type_init ();

	/* Parse command-line options */
	context = g_option_context_new (N_("- Bluetooth applet"));
	g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
	g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
	g_option_context_add_group (context, gtk_get_option_group (TRUE));
	if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
		g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
			 error->message, argv[0]);
		g_error_free (error);
		return 1;
	}

	if (option_debug == FALSE) {
		GError *error = NULL;

		app = g_application_new ("org.cinnamon.Bluetooth.applet",
					 G_APPLICATION_FLAGS_NONE);
		if (!g_application_register (app, NULL, &error)) {
			g_object_unref (app);
			g_warning ("%s", error->message);
			g_error_free (error);
			return 1;
		}
		if (g_application_get_is_remote (app)) {
			g_object_unref (app);
			g_warning ("Applet is already running, exiting");
			return 0;
		}
	} else {
		app = NULL;
	}

	g_set_application_name(_("Bluetooth Applet"));

	gtk_window_set_default_icon_name("bluetooth");

	applet = g_object_new (BLUETOOTH_TYPE_APPLET, NULL);
	g_signal_connect (G_OBJECT (applet), "notify::killswitch-state",
			G_CALLBACK (killswitch_state_changed), NULL);

	menu = create_popupmenu();

#ifdef HAVE_APP_INDICATOR
	indicator = init_notification();
	app_indicator_set_menu(indicator, GTK_MENU(menu));
	app_indicator_set_title(indicator, _("Bluetooth"));
	gsettings = g_settings_new (BLUETOOTH_INDICATOR_GSETTINGS_SCHEMA_ID);
	g_signal_connect (gsettings, "changed::" GSETTINGS_VISIBLE_KEY,
	                  G_CALLBACK(update_icon_visibility), NULL);
#else
	statusicon = init_notification();
#endif /* HAVE_APP_INDICATOR */

	g_signal_connect (G_OBJECT (applet), "devices-changed",
			G_CALLBACK (update_device_list), NULL);
	g_signal_connect (G_OBJECT (applet), "notify::discoverable",
			G_CALLBACK (update_discoverability), NULL);
	g_signal_connect (G_OBJECT (applet), "notify::show-full-menu",
			G_CALLBACK (update_menu_items), NULL);

	killswitch_state_changed ((GObject*) applet, NULL, NULL);
	update_menu_items ((GObject*) applet, NULL, NULL);
	update_discoverability ((GObject*) applet, NULL, NULL);
	update_device_list (applet, NULL);

	update_icon_visibility();

#ifndef HAVE_APP_INDICATOR
	g_signal_connect(statusicon, "activate",
				G_CALLBACK(activate_callback), menu);
	g_signal_connect(statusicon, "popup-menu",
				G_CALLBACK(popup_callback), menu);
#endif /* HAVE_APP_INDICATOR */

	setup_agents(applet);

	gtk_main();

	gtk_widget_destroy(menu);

	cleanup_notification();

	g_object_unref(applet);

	if (app != NULL)
		g_object_unref (app);

	return 0;
}
示例#7
0
文件: proj.c 项目: juddy/edcde
/*
 * Action: Show the module when double-clicked on.
 */
static void
show_module(
    Widget widget, 
    XEvent *event, 
    String *params, 
    int num_params
)
{
    Vwr         v = NULL;
    VNode       selected_node;
    VMethods    m;
    ABObj       obj;
    ABObj       winobj;
    AB_TRAVERSAL trav;
 
    XtVaGetValues(widget, XmNuserData, &v, NULL);

    if (!v)
        return;

    selected_node = vwr_locate_node(v,
                        event->xbutton.x, event->xbutton.y);

    if (selected_node)
    {
        VNode   *selected_nodes = NULL;
        int     num_selected = 0;
 
        if (!(m = v->methods))
            return;

        /* USE METHODS !! */
        obj = (ABObj) selected_node->obj_data;
 
        if (!obj)
            return;

        /*
         * Set busy cursor before this potentially
         * lengthy operation
         */
        ab_set_busy_cursor(TRUE);

        /* If the module is already showing, then
         * make all of its windows come to the fore-
         * ground.
         */
        if (obj_has_flag(obj, MappedFlag))
        {
            for (trav_open(&trav, obj, AB_TRAV_WINDOWS);
                (winobj = trav_next(&trav)) != NULL; )
            {
                if (obj_has_flag(winobj, MappedFlag))
                    ui_win_front(objxm_get_widget(winobj));
            }
            trav_close(&trav);
            proj_set_cur_module(obj);
        }    
        else if( abobj_show_tree(obj, TRUE) == -1 )
        {
           if (util_get_verbosity() > 0)
             fprintf(stderr,"show_module: error in abobj_show_tree\n");
	}
        else 
        {
            proj_set_cur_module(obj);
        }

        vwr_get_cond(v->current_tree, &selected_nodes,
                        &num_selected, select_fn);

        if (selected_nodes)                        
            free((char *)selected_nodes);
 
        update_menu_items(0, num_selected);

        /*
         * Unset busy cursor
         */
        ab_set_busy_cursor(FALSE);

    }
}
示例#8
0
文件: proj.c 项目: juddy/edcde
static void
project_rband(
    Widget	widget,
    XEvent	*event,
    XRectangle	*rb_rect,
    XtPointer	client_data
)
{
    Vwr		v = NULL;
    VNode	*selected_nodes = NULL;
    VMethods	m;
    ABSelectedRec	old_sel, 
			new_sel;
    XRectangle	tmp_rect;
    int		num_selected = 0,
		num_cur_selected = 0,
		i;

    XtVaGetValues(widget, XmNuserData, &v, NULL); 

    if (!v)
	return;

    if (!(m = v->methods))
	return;
    
    /* If rubberband was drawn from lower-right to upper-left,
     * translate rect so that x,y is upper-left point in rectangle.
     */
    if (rect_right(rb_rect) < rb_rect->x ||
	rect_bottom(rb_rect) < rb_rect->y)
    {
	tmp_rect.x = rect_right(rb_rect);
	tmp_rect.y = rect_bottom(rb_rect);
	tmp_rect.width = rb_rect->x - tmp_rect.x;
	tmp_rect.height = rb_rect->y - tmp_rect.y;
	rb_rect = &tmp_rect;
    }

    /*
     * Important: set rband_rect so that
     * the function 'project_select_rband' can see it.
     */
    rband_rect = rb_rect;

    /*
     * Get list of currently selected modules in project
     * organizer
     */
    vwr_get_cond(v->current_tree, &selected_nodes, 
			&num_selected, select_fn);

    if (mselect_adjust)
	/*
	 * If select adjust, remember how many modules are currently
	 * selected
	 */
	num_cur_selected = num_selected;
    else
    {
	/*
	 * If not select adjust, the current select count is reset
	 */
	num_cur_selected = 0;

	/*
	 * Deselect all currently selected nodes
	 */
        for (i=0; i < num_selected; ++i)
	{
	    ABObj	obj;

	    /*
	     * Get ABObj
	     */
	    obj = (ABObj)selected_nodes[i]->obj_data;

	    if (!obj)
	        continue;

	    proj_deselect(obj);
	}
    }

    /*
     * Free up node list if it contained anything
     */
    if (selected_nodes)
        util_free(selected_nodes);

    /*
     * Get nodes in browser that are within the
     * rubber band rectangle.
     */
    vwr_get_cond(v->current_tree, &selected_nodes, 
			&num_selected, project_select_rband);
    
    /*
     * Update (activate/deactivate) project organizer menu items
     */
    update_menu_items(0, num_cur_selected + num_selected);

    /*
     * Return if no selected nodes
     */
    if (num_selected == 0)
	return;

    /*
     * For each object enclosed in rubber band rectangle
     */
    for (i=0; i < num_selected; ++i)
    {
	ABObj	obj;
	int	j;

	/*
	 * Get ABObj
	 */
	obj = (ABObj)selected_nodes[i]->obj_data;

	if (!obj)
	    continue;

	proj_select(obj);
    }

    /*
     * Unset rband_rect
     */
    rband_rect = NULL;

    /*
     * Free up node list if it contained anything
     */
    if (selected_nodes)
	util_free(selected_nodes);
}
int device_recovery_start() {
    dualboot_init();
    update_menu_items();
    return 0;
}