Exemple #1
0
/*
 * remove handlers for audio/ISDN input
 */
void session_io_handlers_stop(session_t *session) {
  if (!(session->option_release_devices &&
	(session->state == STATE_READY ||
	 session->state == STATE_RINGING_QUIET))) {
    gtk_input_remove(session->gtk_audio_input_tag);
  }
  gtk_input_remove(session->gtk_isdn_input_tag);
  gtk_input_remove(session->gtk_local_input_tag);
}
Exemple #2
0
/*
 * put a graceful delay into GTK main loop to prevent permanent isdn input
 * callback
 */
static void gtk_isdn_input_defer(session_t* session) {
  gtk_input_remove(session->gtk_isdn_input_tag);
  session->gtk_isdn_input_tag =
    gtk_timeout_add(DEFER_INTERVAL,
                    (GtkFunction) gtk_isdn_input_defer_timeout,
		    session);
}
Exemple #3
0
/*
 * Reset sound device and unset callback
 */
void session_effect_stop(session_t *session) {
  if (session->effect != EFFECT_NONE) { /* stop only if already playing */
    if (session->effect == EFFECT_SOUNDFILE) {
      sf_close(session->effect_sndfile);
      free(session->effect_sndfile_buffer);
    }
    gtk_input_remove(session->effect_tag);
    session->effect = EFFECT_NONE;
  }
  session_io_handlers_stop(session);
  session_reset_audio(session);
  session_io_handlers_start(session);
}
Exemple #4
0
void CGtkSocket::selectEvent(int event)
{
	if (input_handler_id)
		gtk_input_remove(input_handler_id);
	
	GdkInputCondition condition;
	condition = (GdkInputCondition)0;
	if (event & Socket::READ)
		condition = (GdkInputCondition)(condition | GDK_INPUT_READ);
	if (event & Socket::WRITE)
		condition = (GdkInputCondition)(condition | GDK_INPUT_WRITE);
	if (event & Socket::EXCEPTION)
		condition = (GdkInputCondition)(condition | GDK_INPUT_EXCEPTION);
	input_handler_id = gtk_input_add_full(source, condition, (GdkInputFunction)on_input, NULL, this, NULL);
}
Exemple #5
0
static void lcrt_serial_disconnect(struct lcrt_terminal *lterminal)
{
    struct lcrt_serial_tm *tserial = lterminal->private_data;
    debug_where();
    if (lterminal->connected) {
        if (tserial && tserial->fd > 0) {
            close(tserial->fd);
        }
        lcrt_terminal_on_child_exited(NULL, lterminal);
        lcrt_terminal_set_status(lterminal, NULL, LCRT_TERMINAL_DISCONNECT);
    }
    if (tserial) {
        g_signal_handler_disconnect(lterminal->terminal, tserial->commit);
        gtk_input_remove(tserial->input);
        free(tserial);
        lterminal->private_data = NULL;
    }
    debug_where();
}
Exemple #6
0
void dvdpipe_handler(gpointer data, gint source,
		     GdkInputCondition condition)
{
  char buf[1];
  
  if(!read(source, buf, 1)) {
    gtk_input_remove(dvdpipe_handler_id);
  }

  if(buf[0] == 'q') {
    DVDResult_t res;

    autosave_bookmark();
    
    res = DVDCloseNav(nav);
    if(res != DVD_E_Ok ) {
      DVDPerror("DVDCloseNav", res);
    }
    exit(0);
  } 
}
Exemple #7
0
CGtkSocket::~CGtkSocket()
{
	if (input_handler_id)
		gtk_input_remove(input_handler_id);
}
Exemple #8
0
void on_data_available(gpointer tab, gint fd, GdkInputCondition cond)
{
  GtkWidget *notebook, *top;
  gchar *buff = NULL;
  gsize len = 0;
  SESSION_STATE *session;
  session = g_object_get_data(G_OBJECT(tab), "session");

  telnet_process(session->telnet, &buff, &len);

  //if nothing to process - don't process
  if( len > 0 )
    process_text(session, buff, len);

  // if top != current window change title
  top = gtk_widget_get_toplevel(GTK_WIDGET(tab));
  //if (top != interface_get_active_window()) {
  if (!gtk_window_is_active(GTK_WINDOW(top)))
  {
    gchar *icon;
    gtk_window_set_title(GTK_WINDOW(top), "### MudMagic ###");
    icon = g_build_filename( mudmagic_data_directory(), "interface", "mudmagic2.xpm", NULL);
    gtk_window_set_icon_from_file(GTK_WINDOW(top), icon, NULL);
    g_free(icon);
  }

  if (session->telnet->fd < 0 ) // connection close occurs
  { 
    GtkWidget *wid, *message;
    gchar *label;
    gint response;
    gtk_input_remove(session->input_event_id);
    session->input_event_id = -1;
    wid = g_object_get_data(G_OBJECT(session->tab), "input1_entry");

    g_return_if_fail(wid != NULL);
    if ( ! gtk_entry_get_visibility (GTK_ENTRY(wid)) ) {
      interface_input_shadow(session, FALSE);
      gtk_entry_set_text(GTK_ENTRY(wid), "");
    }

    while (1) {
      wid =
          interface_create_object_by_name
          ("dialog_connection_close");
      if (wid == NULL) {
        g_warning
            ("can't create 'dialog_connection_close");
      }
      message =
          interface_get_widget(wid,
             "connection_close_message");
      if (message == NULL) {
        g_warning
            ("can't get 'dialog_connection_close");
      }
      label =
          g_strdup_printf
          ("Connection to %s:%d has been close.",
           session->game_host, session->game_port);
      gtk_label_set_text(GTK_LABEL(message), label);
      g_free(label);
      response = gtk_dialog_run(GTK_DIALOG(wid));
      gtk_widget_destroy(wid);
      if (response == 0) {  // stay disconnect
        break;
      }
      if (response == 1) {  // try to reconnect
		if (session->pconn) proxy_connection_close (session->pconn);
		session->pconn = proxy_connection_open(
    	  session->game_host, session->game_port, proxy_get_by_name (session->proxy, config->proxies)
	    );
		if (session->pconn) session->telnet->fd = session->pconn->sock; else session->telnet->fd = NO_CONNECTION;

        if (session->telnet->fd == NO_CONNECTION ) {
                          interface_messagebox (GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
                  network_errmsg (session->telnet->fd));
          continue;
        }
        session->input_event_id =
            gtk_input_add_full(session->telnet->fd,
                   GDK_INPUT_READ,(GdkInputFunction)on_data_available, NULL, tab, NULL);
        break;
      }
      if (response == 2) {  // close tab
        interface_remove_tab(tab);
        return;
      }

    }
  }
  // if tab != current tab change label color 
  notebook = gtk_widget_get_ancestor(tab, GTK_TYPE_NOTEBOOK);
  if (notebook) {
    GtkWidget *label;
    GtkWidget *current_tab;

    current_tab =
        gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
                gtk_notebook_get_current_page
                (GTK_NOTEBOOK(notebook))
        );
    if (tab != current_tab) {
      label =
          gtk_notebook_get_tab_label(GTK_NOTEBOOK
                   (notebook),
                   GTK_WIDGET(tab));
      if (label) {
        GtkWidget* icon;
        icon = g_object_get_data (G_OBJECT (label), "label_icon");
        gtk_image_set_from_stock (GTK_IMAGE (icon),
                GTK_STOCK_NO,
                GTK_ICON_SIZE_MENU); 
      }
    }
  }
}