コード例 #1
0
ファイル: service.c プロジェクト: Newterm/florence
/* Called when a dbus method is called */
static void service_method_call (GDBusConnection *connection, const gchar *sender,
	const gchar *object_path, const gchar *interface_name, const gchar *method_name,
	GVariant *parameters, GDBusMethodInvocation *invocation, gpointer user_data)
{
	START_FUNC
	guint x, y;
	struct service *service=(struct service *)user_data;
	if (g_strcmp0(method_name, "show")==0) {
#ifdef AT_SPI
		view_show(service->view, NULL);
#else
		view_show(service->view);
#endif
	} else if (g_strcmp0(method_name, "move")==0) {
		g_variant_get(parameters, "(uu)", &x, &y);
		gtk_window_move(GTK_WINDOW(view_window_get(service->view)), x, y);
	} else if (g_strcmp0(method_name, "hide")==0) view_hide(service->view);
	else if (g_strcmp0(method_name, "terminate")==0) service->quit();
	else flo_error(_("Unknown dbus method called: <%s>"), method_name);
	g_dbus_method_invocation_return_value(invocation, NULL);
	END_FUNC
}
コード例 #2
0
ファイル: list.c プロジェクト: BackupTheBerlios/xiqual-svn
/* Main draw method, as called by LUI (normally).
 * A custom ondraw() method could fill the view
 * with pictures or text.
 */
void lst_draw(lui_list *lst)
{
	SDL_Rect	rect;

	rect.x = lst->x;
	rect.y = lst->y;
	view_hide(lst->view);
	SDL_BlitSurface(lst->bg, NULL, lst->screen, &rect);
	if(lst->ondraw) lst->ondraw(lst->first, lst->view->image, lst->data);
	if(lst->flags & LUIF_GHOSTED) {
		lst->flags ^= LUIF_GHOSTED;
		lui_ghost((gadget *)lst);
	}
	view_show(lst->view);
}
コード例 #3
0
ファイル: vsearch.c プロジェクト: knusbaum/Wily
/* We've clicked the 'goto' button, selecting 'r' in 'v'
 * If this window is under external control, just send the event,
 * otherwise expand the selection, and 'goto' it, in the context of 'v'.
 */
void
b3(View *v, Range r) {
	char	*s;
	View *oldv;
	Range expanded;
	Data	*d;
	View*found;
	
	/* Try to send simply expanded version to remote process */
	expanded = view_expand(v, r, notaddress);
	if (!RLEN(expanded))
		return;	/* empty click nowhere -- ignore */
	s = text_duputf(v->t, expanded);
	d = view_data(v);
	oldv = v;
	
	/* Send to remote process? */
	if(data_sendgoto(d,expanded, s))
		goto cleanup;
	
	
	if (view_gotofile(&v, &expanded, s)) { /* Simple file? */
		r = expanded;
	} else if ( (found = openinclude(v,r)) ) {
		v = found;
		r = found->sel;
	} else if (view_literal(&v, &expanded, s)) { /* Literal? */
		r = expanded;
	} else {	/* found nothing */
		goto cleanup;
	}
	
	view_show(v,r);
	view_select(v,r);
	view_setlastselection(v);

	/* warp unless b3 in the tag jumps to the body. */
	if (oldv != tile_tag(view_win(v)))
		view_warp(v,r);
	
cleanup:
	free(s);
}
コード例 #4
0
ファイル: warlockview.c プロジェクト: sproctor/warlock-gtk
static WarlockView *
warlock_view_init (const char *name, const char *title,
		const char *menu_name)
{
        WarlockView *warlock_view;

        warlock_view = g_new (WarlockView, 1);
	warlock_view->widget = NULL;
	warlock_view->menuitem = NULL;
	warlock_view->scrolled_window = NULL;
	warlock_view->text_view = NULL;
	warlock_view->name = name;
	warlock_view->title = title;

	views = g_list_append (views, warlock_view);

	if (menu_name != NULL) {
		warlock_view->shown_key = preferences_get_full_key 
			(g_strconcat (name, "-view", NULL));
		warlock_view->shown = preferences_get_bool
			(warlock_view->shown_key);
		warlock_view->menuitem = warlock_get_widget (menu_name);
		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
				(warlock_view->menuitem), warlock_view->shown);
	} else {
		warlock_view->shown_key = NULL;
		warlock_view->widget = warlock_get_widget ("main_window_frame");
		warlock_view->shown = TRUE;
		main_view = warlock_view;
	}

	if (warlock_view->shown)
		view_show (warlock_view);

        return warlock_view;
}
コード例 #5
0
ファイル: main.c プロジェクト: smatting/pulsemixer
int main(int argc, char **argv)
{
    int retval = 0;

    struct timeval timeout, timeout_def;

    pa_mainloop * ml = pa_mainloop_new();
    pa_mainloop_api * api = pa_mainloop_get_api(ml);
    pa_context_state_t pa_state;

    pa_context * context = pa_context_new(api, "pa-mixer");
    pa_context_connect(context, NULL, 0, NULL);
    pa_context_set_state_callback(context, pa_state_changed, &pa_state);

    /*
    struct sigaction sigint_handler;
    sigint_handler.sa_handler = handle_sig_int;
    sigemptyset(&sigint_handler.sa_mask);
    sigint_handler.sa_flags = 0;
    sigaction(SIGINT, &sigint_handler, NULL);
    */

    int init_done = 0;

    initscr();
    keypad(stdscr, TRUE);
    start_color();
    curs_set(0);
    cbreak();
    noecho();
    init_pair(1, COLOR_WHITE, COLOR_BLACK);
    init_pair(2, COLOR_WHITE, COLOR_BLUE);

    fd_set read_set, test_set;
    FD_ZERO(&read_set);
    FD_SET(0, &read_set);
    timeout_def.tv_sec = 0;
    timeout_def.tv_usec = 1000;

    view_init();

    while(running) {
        if(pa_state == PA_CONTEXT_UNCONNECTED) {
            pa_mainloop_iterate(ml, 1, NULL);
            continue;
        }
        if(pa_state == PA_CONTEXT_FAILED || pa_state == PA_CONTEXT_TERMINATED) {
            running = 0;
            retval = -1;
        }
        if(pa_state == PA_CONTEXT_READY) {
            if(!init_done) {
                pa_context_set_subscribe_callback(context, on_event, NULL);
                pa_context_subscribe(context, PA_SUBSCRIPTION_MASK_ALL, NULL, NULL);
                pa_context_get_sink_input_info_list(context, on_sink_input_update, context);
                pa_context_get_sink_info_list(context, on_sink_update, context);
            }
            init_done = 1;
        }

        test_set = read_set;
        timeout = timeout_def;
        int r = select(1, &test_set, NULL, NULL, &timeout);
        if(r == 0) {
            /* timeout */
            pa_mainloop_iterate(ml, 0, NULL);
        }
        if(FD_ISSET(0, &test_set)) {
            /* stdin ready */

            int key = getch();
            switch(key) {
                case KEY_UP:
                    view_select_prev();
                    view_show();
                    break;
                case KEY_DOWN:
                    view_select_next();
                    view_show();
                    break;
                case KEY_LEFT:
                    change_sel_vol(context, VOL_DOWN);
                    break;
                case KEY_RIGHT:
                    change_sel_vol(context, VOL_UP);
                    break;
                case 'n':
                    change_sel_vol(context, VOL_NORM);
                    break;
                case 'm':
                    change_sel_vol(context, VOL_MUTE);
                    break;
                case 'q':
                    running = 0;
                    break;
                case KEY_RESIZE:
                    view_show();
                    refresh();
                    break;
            }
        }

    }

    pa_context_disconnect(context);
    pa_context_unref(context);
    pa_mainloop_free(ml);

    endwin();

    return retval;
}
コード例 #6
0
ファイル: warlockview.c プロジェクト: sproctor/warlock-gtk
void
warlock_view_show (const char *name)
{
        view_show (get_view (name));
}