Пример #1
0
static void
nemo_floating_bar_hide (GtkWidget *widget)
{
	NemoFloatingBar *self = NEMO_FLOATING_BAR (widget);

	GTK_WIDGET_CLASS (nemo_floating_bar_parent_class)->hide (widget);

	gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
}
Пример #2
0
static void
nautilus_floating_bar_hide (GtkWidget *widget)
{
	NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (widget);

	GTK_WIDGET_CLASS (nautilus_floating_bar_parent_class)->hide (widget);

	gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
}
static void
athena_floating_bar_hide (GtkWidget *widget)
{
	AthenaFloatingBar *self = ATHENA_FLOATING_BAR (widget);

	GTK_WIDGET_CLASS (athena_floating_bar_parent_class)->hide (widget);

	gtk_spinner_stop (GTK_SPINNER (self->priv->spinner));
}
Пример #4
0
static void scanning_cb(void *user_data)
{
	GtkSpinner *spin;

	spin = (GtkSpinner *)gtk_bin_get_child(GTK_BIN(cui_scan_spinner));

	gtk_spinner_stop(spin);
	gtk_widget_hide((GtkWidget *)cui_scan_spinner);
	gtk_widget_hide((GtkWidget *)spin);
}
Пример #5
0
void
setup_camera (CheeseWidget *widget)
{
  CheeseWidgetPrivate *priv          = CHEESE_WIDGET_GET_PRIVATE (widget);
  char                *webcam_device = NULL;
  int                  x_resolution;
  int                  y_resolution;
  gdouble              brightness;
  gdouble              contrast;
  gdouble              saturation;
  gdouble              hue;

  g_settings_get (priv->settings, "photo-x-resolution", "i", &x_resolution);
  g_settings_get (priv->settings, "photo-y-resolution", "i", &y_resolution);
  g_settings_get (priv->settings, "camera",       "s", &webcam_device);
  g_settings_get (priv->settings, "brightness",   "d", &brightness);
  g_settings_get (priv->settings, "contrast",     "d", &contrast);
  g_settings_get (priv->settings, "saturation",   "d", &saturation);
  g_settings_get (priv->settings, "hue",          "d", &hue);

  gdk_threads_enter ();
  priv->webcam = cheese_camera_new (CLUTTER_TEXTURE (priv->texture),
                                    webcam_device,
                                    x_resolution,
                                    y_resolution);
  gdk_threads_leave ();

  g_free (webcam_device);

  cheese_camera_setup (priv->webcam, NULL, &priv->error);

  gdk_threads_enter ();

  gtk_spinner_stop (GTK_SPINNER (priv->spinner));

  if (priv->error != NULL)
  {
    priv->state = CHEESE_WIDGET_STATE_ERROR;
    g_object_notify (G_OBJECT (widget), "state");
    cheese_widget_set_problem_page (CHEESE_WIDGET (widget), "error");
  }
  else
  {
    cheese_camera_set_balance_property (priv->webcam, "brightness", brightness);
    cheese_camera_set_balance_property (priv->webcam, "contrast", contrast);
    cheese_camera_set_balance_property (priv->webcam, "saturation", saturation);
    cheese_camera_set_balance_property (priv->webcam, "hue", hue);
    priv->state = CHEESE_WIDGET_STATE_READY;
    g_object_notify (G_OBJECT (widget), "state");
    cheese_camera_play (priv->webcam);
    gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), WEBCAM_PAGE);
  }

  gdk_threads_leave ();
}
static void
finish_action (UmAccountDialog *self)
{
        g_debug ("Completed action, enabling dialog controls");

        gtk_widget_set_sensitive (self->container_widget, TRUE);
        gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, TRUE);

        gtk_widget_hide (GTK_WIDGET (self->spinner));
        gtk_spinner_stop (self->spinner);
}
Пример #7
0
static void
set_search_label (BluetoothChooser *self, gboolean state)
{
	BluetoothChooserPrivate *priv = BLUETOOTH_CHOOSER_GET_PRIVATE(self);

	if (priv->show_searching == FALSE) {
		/* Just making sure */
		gtk_spinner_stop (GTK_SPINNER (priv->spinner));
		return;
	}
	if (state == FALSE) {
		gtk_spinner_stop (GTK_SPINNER (priv->spinner));
		gtk_widget_hide (priv->spinner);
		gtk_label_set_text (GTK_LABEL (priv->search_label), _("No adapters available"));
	} else {
		gtk_widget_show (priv->spinner);
		gtk_spinner_start (GTK_SPINNER (priv->spinner));
		gtk_label_set_text (GTK_LABEL (priv->search_label), _("Searching for devices…"));
	}
}
Пример #8
0
void source_spinner_item_stop (SourceSpinnerItem* self) {
#line 30 "source-spinner-item.vala"
	g_return_if_fail (self != NULL);
#line 32 "source-spinner-item.vala"
	gtk_spinner_stop (self->priv->spinner);
#line 33 "source-spinner-item.vala"
	if (gtk_widget_get_parent ((GtkWidget*) self->priv->spinner) == GTK_WIDGET (((SourceItem*) self)->right_align)) {
#line 33 "source-spinner-item.vala"
		gtk_container_remove ((GtkContainer*) ((SourceItem*) self)->right_align, (GtkWidget*) self->priv->spinner);
#line 122 "source-spinner-item.c"
	}
}
Пример #9
0
static void
status_changed_cb(MathEquation *equation, GParamSpec *spec, MathDisplay *display)
{
    gtk_text_buffer_set_text(display->priv->info_buffer, math_equation_get_status(equation), -1);
    if (math_equation_in_solve(equation) && !gtk_widget_get_visible(display->priv->spinner)) {
        gtk_widget_show(display->priv->spinner);
        gtk_spinner_start(GTK_SPINNER(display->priv->spinner));
    }
    else if (!math_equation_in_solve(equation) && gtk_widget_get_visible(display->priv->spinner)) {
        gtk_widget_hide(display->priv->spinner);
        gtk_spinner_stop(GTK_SPINNER(display->priv->spinner));
    }
}
Пример #10
0
static void
state_changed_cb (GtkWidget *widget,
                  GParamSpec *pspec,
                  EmerillonWindow *self)
{
  ChamplainState state;

  g_object_get (self->priv->view, "state", &state, NULL);
  if (state == CHAMPLAIN_STATE_LOADING)
    gtk_spinner_start (GTK_SPINNER (self->priv->throbber));
  else
    gtk_spinner_stop (GTK_SPINNER (self->priv->throbber));
}
Пример #11
0
static void wait_for_child(GPid pid, gint script_retval, gpointer data)
{
	PCon_Spinner *pcspinner = (PCon_Spinner*)data;

	gtk_spinner_stop(GTK_SPINNER(pcspinner->spinner));
	gtk_widget_destroy(GTK_WIDGET(pcspinner->dialog));
	g_spawn_close_pid(pid);
	/* TODO At the moment background processes will fail to start before the
	 * remmina connection.
	 * Adding a delay here could be a (not good) solution, or we should
	 * monitor each child opened, but it could be quit tricky and messy */

	g_free(pcspinner);
}
Пример #12
0
void
nautilus_navigation_window_set_spinner_active (NautilusNavigationWindow *window,
					       gboolean allow)
{
	if (( window->details->spinner_active &&  allow) ||
	    (!window->details->spinner_active && !allow)) {
		return;
	}

	window->details->spinner_active = allow;
	if (allow) {
		gtk_spinner_start (GTK_SPINNER (window->details->spinner));
	} else {
		gtk_spinner_stop (GTK_SPINNER (window->details->spinner));
	}
}
Пример #13
0
void source_spinner_item_set_spinning (SourceSpinnerItem* self, gboolean value) {
	g_return_if_fail (self != NULL);
#line 53 "source-spinner-item.vala"
	gtk_widget_set_visible ((GtkWidget*) self->priv->spinner, value);
#line 54 "source-spinner-item.vala"
	if (value) {
#line 54 "source-spinner-item.vala"
		gtk_spinner_start (self->priv->spinner);
#line 384 "source-spinner-item.c"
	} else {
#line 55 "source-spinner-item.vala"
		gtk_spinner_stop (self->priv->spinner);
#line 388 "source-spinner-item.c"
	}
	g_object_notify ((GObject *) self, "spinning");
}
static void
new_chatroom_dialog_listing_cb (EmpathyTpRoomlist        *room_list,
				gpointer                  unused,
				EmpathyNewChatroomDialog *dialog)
{
	gboolean listing;

	listing = empathy_tp_roomlist_is_listing (room_list);

	/* Update the throbber */
	if (listing) {
		gtk_spinner_start (GTK_SPINNER (dialog->throbber));
		gtk_widget_show (dialog->throbber);
	} else {
		gtk_spinner_stop (GTK_SPINNER (dialog->throbber));
		gtk_widget_hide (dialog->throbber);
	}
}
Пример #15
0
static void
init_statusbar (FsearchApplicationWindow *self)
{
    g_assert (FSEARCH_WINDOW_IS_WINDOW (self));

    gtk_spinner_stop (GTK_SPINNER (self->database_spinner));

    gtk_stack_set_visible_child (GTK_STACK (self->database_stack), self->database_box2);
    Database *db = fsearch_application_get_db (FSEARCH_APPLICATION_DEFAULT);

    uint32_t num_items = 0;
    if (db) {
        num_items = db_get_num_entries (db);
    }

    gchar db_text[100] = "";
    snprintf (db_text, sizeof (db_text), _("%'d Items"), num_items);
    gtk_label_set_text (GTK_LABEL (self->database_label), db_text);
}
Пример #16
0
static void
sw_delay_notify (GObject *obj, GParamSpec *pspec, gpointer data)
{
  GtkWidget *spinner = data;
  gboolean active;
  gboolean state;

  g_object_get (obj,
                "active", &active,
                "state", &state,
                NULL);

  if (active != state)
    {
      gtk_spinner_start (GTK_SPINNER (spinner));
      gtk_widget_set_opacity (spinner, 1.0);
    }
  else
    {
      gtk_widget_set_opacity (spinner, 0.0);
      gtk_spinner_stop (GTK_SPINNER (spinner));
    }
}
Пример #17
0
void
caja_notebook_sync_loading (CajaNotebook *notebook,
                            CajaWindowSlot *slot)
{
    GtkWidget *tab_label, *spinner, *icon;
    gboolean active;

    g_return_if_fail (CAJA_IS_NOTEBOOK (notebook));
    g_return_if_fail (CAJA_IS_WINDOW_SLOT (slot));

    tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), slot->content_box);
    g_return_if_fail (GTK_IS_WIDGET (tab_label));

    spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "spinner"));
    icon = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "icon"));
    g_return_if_fail (spinner != NULL && icon != NULL);

    active = FALSE;
    g_object_get (spinner, "active", &active, NULL);
    if (active == slot->allow_stop)
    {
        return;
    }

    if (slot->allow_stop)
    {
        gtk_widget_hide (icon);
        gtk_widget_show (spinner);
        gtk_spinner_start (GTK_SPINNER (spinner));
    }
    else
    {
        gtk_spinner_stop (GTK_SPINNER (spinner));
        gtk_widget_hide (spinner);
        gtk_widget_show (icon);
    }
}
Пример #18
0
void
nautilus_notebook_sync_loading (NautilusNotebook *notebook,
				NautilusWindowSlot *slot)
{
	GtkWidget *tab_label, *spinner, *icon;
	gboolean active, allow_stop;

	g_return_if_fail (NAUTILUS_IS_NOTEBOOK (notebook));
	g_return_if_fail (NAUTILUS_IS_WINDOW_SLOT (slot));

	tab_label = gtk_notebook_get_tab_label (GTK_NOTEBOOK (notebook), 
						GTK_WIDGET (slot));
	g_return_if_fail (GTK_IS_WIDGET (tab_label));

	spinner = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "spinner"));
	icon = GTK_WIDGET (g_object_get_data (G_OBJECT (tab_label), "icon"));
	g_return_if_fail (spinner != NULL && icon != NULL);

	active = FALSE;
	g_object_get (spinner, "active", &active, NULL);
	allow_stop = nautilus_window_slot_get_allow_stop (slot);

	if (active == allow_stop) {
		return;
	}

	if (allow_stop) {
		gtk_widget_hide (icon);
		gtk_widget_show (spinner);
		gtk_spinner_start (GTK_SPINNER (spinner));
	} else {
		gtk_spinner_stop (GTK_SPINNER (spinner));
		gtk_widget_hide (spinner);
		gtk_widget_show (icon);
	}
}
static void
populate_options_real (PpOptionsDialog *dialog)
{
  GtkTreeSelection *selection;
  GtkTreeModel     *model;
  GtkTreeView      *treeview;
  GtkTreeIter       iter;
  ppd_file_t       *ppd_file;
  GtkWidget        *notebook;
  GtkWidget        *grid;
  GtkWidget        *general_tab_grid = tab_grid_new ();
  GtkWidget        *page_setup_tab_grid = tab_grid_new ();
  GtkWidget        *installable_options_tab_grid = tab_grid_new ();
  GtkWidget        *job_tab_grid = tab_grid_new ();
  GtkWidget        *image_quality_tab_grid = tab_grid_new ();
  GtkWidget        *color_tab_grid = tab_grid_new ();
  GtkWidget        *finishing_tab_grid = tab_grid_new ();
  GtkWidget        *advanced_tab_grid = tab_grid_new ();
  GtkWidget        *widget;
  gint              i, j;

  widget = (GtkWidget*)
    gtk_builder_get_object (dialog->builder, "options-spinner");
  gtk_widget_hide (widget);
  gtk_spinner_stop (GTK_SPINNER (widget));

  widget = (GtkWidget*)
    gtk_builder_get_object (dialog->builder, "progress-label");
  gtk_widget_hide (widget);

  treeview = (GtkTreeView *)
    gtk_builder_get_object (dialog->builder, "options-categories-treeview");

  notebook = (GtkWidget *)
    gtk_builder_get_object (dialog->builder, "options-notebook");

  if (dialog->ipp_attributes)
    {
      /* Add number-up option to Page Setup tab */
      ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
                                           "number-up-supported"),
                      g_hash_table_lookup (dialog->ipp_attributes,
                                           "number-up-default"),
                      "number-up",
                      /* Translators: This option sets number of pages printed on one sheet */
                      _("Pages per side"),
                      dialog->printer_name,
                      page_setup_tab_grid,
                      dialog->sensitive);

      /* Add sides option to Page Setup tab */
      ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
                                           "sides-supported"),
                      g_hash_table_lookup (dialog->ipp_attributes,
                                           "sides-default"),
                      "sides",
                      /* Translators: This option sets whether to print on both sides of paper */
                      _("Two-sided"),
                      dialog->printer_name,
                      page_setup_tab_grid,
                      dialog->sensitive);

      /* Add orientation-requested option to Page Setup tab */
      ipp_option_add (g_hash_table_lookup (dialog->ipp_attributes,
                                           "orientation-requested-supported"),
                      g_hash_table_lookup (dialog->ipp_attributes,
                                           "orientation-requested-default"),
                      "orientation-requested",
                      /* Translators: This option sets orientation of print (portrait, landscape...) */
                      _("Orientation"),
                      dialog->printer_name,
                      page_setup_tab_grid,
                      dialog->sensitive);
    }

  if (dialog->destination && dialog->ppd_filename)
    {
      ppd_file = ppdOpenFile (dialog->ppd_filename);
      ppdLocalize (ppd_file);

      if (ppd_file)
        {
          ppdMarkDefaults (ppd_file);
          cupsMarkOptions (ppd_file,
                           dialog->destination->num_options,
                           dialog->destination->options);

          for (i = 0; i < ppd_file->num_groups; i++)
            {
              for (j = 0; j < ppd_file->groups[i].num_options; j++)
                {
                  grid = NULL;

                  if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                       color_group_whitelist))
                    grid = color_tab_grid;
                  else if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                            image_quality_group_whitelist))
                    grid = image_quality_tab_grid;
                  else if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                            job_group_whitelist))
                    grid = job_tab_grid;
                  else if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                            finishing_group_whitelist))
                    grid = finishing_tab_grid;
                  else if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                            installable_options_group_whitelist))
                    grid = installable_options_tab_grid;
                  else if (STRING_IN_TABLE (ppd_file->groups[i].name,
                                            page_setup_group_whitelist))
                    grid = page_setup_tab_grid;

                  if (!STRING_IN_TABLE (ppd_file->groups[i].options[j].keyword,
                                        ppd_option_blacklist))
                    {
                      if (!grid && STRING_IN_TABLE (ppd_file->groups[i].options[j].keyword,
                                                    color_option_whitelist))
                        grid = color_tab_grid;
                      else if (!grid && STRING_IN_TABLE (ppd_file->groups[i].options[j].keyword,
                                                         image_quality_option_whitelist))
                        grid = image_quality_tab_grid;
                      else if (!grid && STRING_IN_TABLE (ppd_file->groups[i].options[j].keyword,
                                                         finishing_option_whitelist))
                        grid = finishing_tab_grid;
                      else if (!grid && STRING_IN_TABLE (ppd_file->groups[i].options[j].keyword,
                                                         page_setup_option_whitelist))
                        grid = page_setup_tab_grid;

                      if (!grid)
                        grid = advanced_tab_grid;

                      ppd_option_add (ppd_file->groups[i].options[j],
                                      dialog->printer_name,
                                      grid,
                                      dialog->sensitive);
                    }
                }
            }

          ppdClose (ppd_file);
        }
    }

  dialog->ppd_filename_set = FALSE;
  if (dialog->ppd_filename)
    {
      g_unlink (dialog->ppd_filename);
      g_free (dialog->ppd_filename);
      dialog->ppd_filename = NULL;
    }

  dialog->destination_set = FALSE;
  if (dialog->destination)
    {
      cupsFreeDests (1, dialog->destination);
      dialog->destination = NULL;
    }

  dialog->ipp_attributes_set = FALSE;
  if (dialog->ipp_attributes)
    {
      g_hash_table_unref (dialog->ipp_attributes);
      dialog->ipp_attributes = NULL;
    }

  /* Translators: "General" tab contains general printer options */
  tab_add (C_("Printer Option Group", "General"), notebook, treeview, general_tab_grid);

  /* Translators: "Page Setup" tab contains settings related to pages (page size, paper source, etc.) */
  tab_add (C_("Printer Option Group", "Page Setup"), notebook, treeview, page_setup_tab_grid);

  /* Translators: "Installable Options" tab contains settings of presence of installed options (amount of RAM, duplex unit, etc.) */
  tab_add (C_("Printer Option Group", "Installable Options"), notebook, treeview, installable_options_tab_grid);

  /* Translators: "Job" tab contains settings for jobs */
  tab_add (C_("Printer Option Group", "Job"), notebook, treeview, job_tab_grid);

  /* Translators: "Image Quality" tab contains settings for quality of output print (e.g. resolution) */
  tab_add (C_("Printer Option Group", "Image Quality"), notebook, treeview, image_quality_tab_grid);

  /* Translators: "Color" tab contains color settings (e.g. color printing) */
  tab_add (C_("Printer Option Group", "Color"), notebook, treeview, color_tab_grid);

  /* Translators: "Finishing" tab contains finishing settings (e.g. booklet printing) */
  tab_add (C_("Printer Option Group", "Finishing"), notebook, treeview, finishing_tab_grid);

  /* Translators: "Advanced" tab contains all others settings */
  tab_add (C_("Printer Option Group", "Advanced"), notebook, treeview, advanced_tab_grid);

  gtk_widget_show_all (GTK_WIDGET (notebook));

  /* Select the first option group */
  if ((selection = gtk_tree_view_get_selection (treeview)) != NULL)
    {
      g_signal_connect (selection,
                        "changed",
                        G_CALLBACK (category_selection_changed_cb), dialog);

      if ((model = gtk_tree_view_get_model (treeview)) != NULL &&
          gtk_tree_model_get_iter_first (model, &iter))
        gtk_tree_selection_select_iter (selection, &iter);
    }

  dialog->populating_dialog = FALSE;
  if (dialog->response != GTK_RESPONSE_NONE)
    {
      dialog->user_callback (GTK_DIALOG (dialog->dialog), dialog->response, dialog->user_data);
    }
}
Пример #20
0
static void
stop_spinner(I7SearchWindow *self)
{
	gtk_spinner_stop(GTK_SPINNER(self->spinner));
	gtk_widget_hide(self->spinner);
}
Пример #21
0
static VALUE
rg_stop(VALUE self)
{
    gtk_spinner_stop(_SELF(self));
    return self;
}
static void
new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
					EmpathyNewChatroomDialog *dialog)
{
	EmpathyAccountChooser *account_chooser;
	gboolean               listing = FALSE;
	gboolean               expanded = FALSE;
	TpConnection          *connection;
	TpCapabilities *caps;

	if (dialog->room_list) {
		g_object_unref (dialog->room_list);
		dialog->room_list = NULL;
	}

	gtk_spinner_stop (GTK_SPINNER (dialog->throbber));
	gtk_widget_hide (dialog->throbber);
	new_chatroom_dialog_model_clear (dialog);

	if (dialog->account != NULL) {
		g_signal_handler_disconnect (dialog->account, dialog->status_changed_id);
		g_object_unref (dialog->account);
	}

	account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
	dialog->account = empathy_account_chooser_dup_account (account_chooser);
	connection = empathy_account_chooser_get_connection (account_chooser);
	if (dialog->account == NULL)
		goto out;

	dialog->status_changed_id = g_signal_connect (dialog->account,
		      "status-changed", G_CALLBACK (account_status_changed_cb), dialog);

	/* empathy_account_chooser_filter_supports_chatrooms ensures that the
	* account has a connection and CAPABILITIES has been prepared. */
	g_assert (connection != NULL);
	g_assert (tp_proxy_is_prepared (connection,
		TP_CONNECTION_FEATURE_CAPABILITIES));
	caps = tp_connection_get_capabilities (connection);

	if (tp_capabilities_supports_room_list (caps, NULL)) {
		/* Roomlist channels are supported */
		dialog->room_list = empathy_tp_roomlist_new (dialog->account);
	}
	else {
		dialog->room_list = NULL;
	}

	if (dialog->room_list) {
		g_signal_connect (dialog->room_list, "destroy",
				  G_CALLBACK (new_chatroom_dialog_roomlist_destroy_cb),
				  dialog);
		g_signal_connect (dialog->room_list, "new-room",
				  G_CALLBACK (new_chatroom_dialog_new_room_cb),
				  dialog);
		g_signal_connect (dialog->room_list, "notify::is-listing",
				  G_CALLBACK (new_chatroom_dialog_listing_cb),
				  dialog);
		g_signal_connect (dialog->room_list, "error::start",
				  G_CALLBACK (start_listing_error_cb),
				  dialog);
		g_signal_connect (dialog->room_list, "error::stop",
				  G_CALLBACK (stop_listing_error_cb),
				  dialog);

		expanded = gtk_expander_get_expanded (GTK_EXPANDER (dialog->expander_browse));
		if (expanded) {
			gtk_widget_hide (dialog->viewport_error);
			gtk_widget_set_sensitive (dialog->treeview, TRUE);
			new_chatroom_dialog_browse_start (dialog);
		}

		listing = empathy_tp_roomlist_is_listing (dialog->room_list);
		if (listing) {
			gtk_spinner_start (GTK_SPINNER (dialog->throbber));
			gtk_widget_show (dialog->throbber);
		}
	}

	gtk_widget_set_sensitive (dialog->expander_browse, dialog->room_list != NULL);

out:
	new_chatroom_dialog_update_widgets (dialog);
}
Пример #23
0
void *reader_loop(void* wojd) {

    mkfifo(fpipeout, S_IRWXU);
    FILE *fileout = fopen(fpipeout, "a+");
    if(!fileout) {
        fprintf(stderr, "Error opening pipe %s !\n", fpipeout);
        pthread_exit(NULL);
    }


    mkfifo(fpipein, S_IRWXU);
    FILE *filein = fopen(fpipein, "r+");
    if(!filein) {
        fprintf(stderr, "Error opening pipe %s !\n", fpipein);
        pthread_exit(NULL);
    }

    if(VERBOSE)
        fprintf(stderr, "Using pipes out:%s in:%s\n", fpipeout, fpipein);


    char input[1024];
    char *operanda = NULL;
    char *object = NULL;
    char *command = NULL;


    while(RUNNING) {
        fgets(input, 1024, filein);

        if(!RUNNING)
            break;

        object = input;
        command = input;
        operanda = input;

        while(*command && *command != ' ')
            command++;

        *command = '\0';
        operanda = ++command;

        while(*operanda && *operanda != ' ')
            operanda++;
        *operanda++ = '\0';

        if(VERBOSE)
            fprintf(stderr, "Command:> %s %s %s\n", object, command, operanda);

        GtkWidget *widget = GTK_WIDGET(gtk_builder_get_object(builder, object));


        //window set title
        if(!strcmp(command, "set_window_title")) {
            gtk_window_set_title(GTK_WINDOW(widget), operanda);
        } else

            //window show
            if(!strcmp(command, "show")) {
                gtk_widget_show(widget);
            } else

                //window hide
                if(!strcmp(command, "hide")) {
                    gtk_widget_hide(widget);
                } else


                    //textview set text
                    if(!strcmp(command, "set_textview_text")) {
                        gtk_text_buffer_set_text(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), operanda, -1);
                    } else

                        //textview get text
                        if(!strcmp(command, "get_textview_text")) {
                            GtkTextIter a, b;
                            GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget));
                            gtk_text_buffer_get_iter_at_offset(buffer, &a, 0);
                            gtk_text_buffer_get_iter_at_offset(buffer, &b, -1);
                            gchar* mtext = gtk_text_buffer_get_text(buffer, &a, &b, FALSE);
                            fprintf(fileout, "%s\n", mtext);
                            fflush(fileout);
                        } else
                            //

                            //spinner activate/deactivate
                            if(!strcmp(command, "spinner_start")) {
                                gtk_spinner_start(GTK_SPINNER(widget));
                            } else

                                if(!strcmp(command, "spinner_stop")) {
                                    gtk_spinner_stop(GTK_SPINNER(widget));
                                } else

                                    //label set/get
                                    if(!strcmp(command, "set_label_text")) {
                                        gtk_label_set_text(GTK_LABEL(widget), operanda);
                                    } else

                                        //set button label
                                        if(!strcmp(command, "set_button_label")) {
                                            gtk_button_set_label(GTK_BUTTON(widget), operanda);
                                        } else

                                            //entrytext set/get
                                            if(!strcmp(command, "get_entry_text")) {
                                                gchar* mtext = gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
                                                fprintf(fileout, "%s\n", mtext);
                                                fflush(fileout);
                                            } else

                                                if(!strcmp(command, "set_entry_text")) {
                                                    gtk_entry_set_text(GTK_ENTRY(widget), operanda);
                                                } else


                                                    //combobox add options, get/set selected
                                                    if(!strcmp(command, "set_combobox_items")) {
                                                        //GtkTreeModel *tree_model;
                                                        //gtk_combo_box_model_set(GTK_COMBO_BOX(widget), tree_model);

                                                    } else if(!strcmp(command, "get_selected_combobox_item")) {
                                                        fprintf(fileout, "%d\n", gtk_combo_box_get_active(GTK_COMBO_BOX(widget)));
                                                        fflush(fileout);
                                                    } else

                                                        //image set image TODO doesn't work
                                                        if(!strcmp(command, "set_image")) {
                                                            gtk_image_set_from_file(GTK_IMAGE(widget), operanda);
                                                            gtk_widget_show(widget);
                                                        } else

                                                            //progressbar set, show/hide
                                                            if(!strcmp(command, "set_progressbar")) {

                                                            } else

                                                                //togglebutton istoggled //toggle, check, radio button
                                                                if(!strcmp(command, "get_button_state")) {
                                                                    if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
                                                                        fprintf(fileout, "1\n");
                                                                    else
                                                                        fprintf(fileout, "0\n");
                                                                    fflush(fileout);
                                                                }

    }

    fclose(filein);
    fflush(fileout);
    fclose(fileout);
    pthread_exit(NULL);
}
Пример #24
0
void
gs_stop_spinner (GtkSpinner *spinner)
{
	g_object_set_data (G_OBJECT (spinner), "start-timeout", NULL);
	gtk_spinner_stop (spinner);
}