Esempio n. 1
0
void
cb_change_current_page (GtkNotebook *nb, gint num, gpointer data)
{
    ProcData * const procdata = static_cast<ProcData*>(data);

    procdata->config.current_tab = num;


    if (num == PROCMAN_TAB_PROCESSES) {

        cb_timeout (procdata);

        if (!procdata->timeout)
            procdata->timeout = g_timeout_add (
                procdata->config.update_interval,
                cb_timeout, procdata);

        update_sensitivity(procdata);
    }
    else {
        if (procdata->timeout) {
            g_source_remove (procdata->timeout);
            procdata->timeout = 0;
        }

        update_sensitivity(procdata);
    }


    if (num == PROCMAN_TAB_RESOURCES) {
        load_graph_start (procdata->cpu_graph);
        load_graph_start (procdata->mem_graph);
        load_graph_start (procdata->net_graph);
    }
    else {
        load_graph_stop (procdata->cpu_graph);
        load_graph_stop (procdata->mem_graph);
        load_graph_stop (procdata->net_graph);
    }


    if (num == PROCMAN_TAB_DISKS) {

        cb_update_disks (procdata);

        if(!procdata->disk_timeout) {
            procdata->disk_timeout =
                g_timeout_add (procdata->config.disks_update_interval,
                               cb_update_disks,
                               procdata);
        }
    }
    else {
        if(procdata->disk_timeout) {
            g_source_remove (procdata->disk_timeout);
            procdata->disk_timeout = 0;
        }
    }
    
}
Esempio n. 2
0
void
update_page_activities (GsmApplication *app)
{
    const char *current_page = gtk_stack_get_visible_child_name (app->stack);

    if (strcmp (current_page, "processes") == 0) {
        GAction *search_action = g_action_map_lookup_action (G_ACTION_MAP (app->main_window),
                                                             "search");
        proctable_update (app);
        proctable_thaw (app);

        gtk_widget_show (GTK_WIDGET (app->end_process_button));
        gtk_widget_show (GTK_WIDGET (app->search_button));
        gtk_widget_show (GTK_WIDGET (app->process_menu_button));

        update_sensitivity (app);

        if (g_variant_get_boolean (g_action_get_state (search_action)))
            gtk_widget_grab_focus (GTK_WIDGET (app->search_entry));
        else
            gtk_widget_grab_focus (GTK_WIDGET (app->tree));
    } else {
        proctable_freeze (app);

        gtk_widget_hide (GTK_WIDGET (app->end_process_button));
        gtk_widget_hide (GTK_WIDGET (app->search_button));
        gtk_widget_hide (GTK_WIDGET (app->process_menu_button));

        update_sensitivity (app);
    }

    if (strcmp (current_page, "resources") == 0) {
        load_graph_start (app->cpu_graph);
        load_graph_start (app->mem_graph);
        load_graph_start (app->net_graph);
    } else {
        load_graph_stop (app->cpu_graph);
        load_graph_stop (app->mem_graph);
        load_graph_stop (app->net_graph);
    }

    if (strcmp (current_page, "disks") == 0) {
        disks_update (app);
        disks_thaw (app);
    } else {
        disks_freeze (app);
    }
}
static void
marco_settings_changed_callback (GSettings *settings,
                                 const gchar *key,
                                 gpointer user_data)
{
    update_sensitivity ();
}
Esempio n. 4
0
static void
list_source_files (gpointer user_data)
{
	DialogData *data = user_data;
	GList      *list;

	_g_clear_object (&data->last_source);
	_g_object_list_unref (data->files);
	data->files = NULL;

	if (data->source == NULL) {
		gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("(Empty)"));
		update_sensitivity (data);
		return;
	}

	gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("Getting the folder content…"));

	data->loading_list = TRUE;
	list = g_list_prepend (NULL, data->source);
	_g_query_all_metadata_async (list,
				     GTH_LIST_RECURSIVE | GTH_LIST_NO_HIDDEN_FILES | GTH_LIST_NO_BACKUP_FILES,
				     DEFINE_STANDARD_ATTRIBUTES (",preview::icon,standard::fast-content-type,gth::file::display-size"),
				     data->cancellable,
				     list_ready_cb,
				     data);

	g_list_free (list);
}
Esempio n. 5
0
static void
list_ready_cb (GList    *files,
	       GError   *error,
	       gpointer  user_data)
{
	DialogData *data = user_data;

	data->loading_list = FALSE;

	if (data->cancelling) {
		gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data);
	}
	else if (error != NULL) {
		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not load the folder"), error);
	}
	else {
		_g_object_unref (data->last_source);
		data->last_source = g_file_dup (data->source);

		data->files = _g_object_list_ref (files);
		gth_file_list_set_files (GTH_FILE_LIST (data->file_list), data->files);
	}

	update_sensitivity (data);
}
Esempio n. 6
0
static void
crop_to_rectangle_changed(MergeControls *controls, GtkToggleButton *toggle)
{
    MergeArgs *args = controls->args;
    args->crop_to_rectangle = gtk_toggle_button_get_active(toggle);
    update_sensitivity(controls);
}
static void
action_changed (GtkComboBox      *combo,
                UmPasswordDialog *um)
{
        gint active;

        active = gtk_combo_box_get_active (combo);
        if (active == 0) {
                gtk_widget_set_sensitive (um->password_entry, TRUE);
                gtk_entry_set_icon_sensitive (GTK_ENTRY (um->password_entry), GTK_ENTRY_ICON_SECONDARY, TRUE);
                gtk_widget_set_sensitive (um->verify_entry, TRUE);
                gtk_widget_set_sensitive (um->old_password_entry, TRUE);
                gtk_widget_set_sensitive (um->strength_indicator_label, TRUE);
                gtk_widget_set_sensitive (um->show_password_button, TRUE);

                update_sensitivity (um);
        }
        else {
                gtk_widget_set_sensitive (um->password_entry, FALSE);
                gtk_entry_set_icon_sensitive (GTK_ENTRY (um->password_entry), GTK_ENTRY_ICON_SECONDARY, FALSE);
                gtk_widget_set_sensitive (um->verify_entry, FALSE);
                gtk_widget_set_sensitive (um->old_password_entry, FALSE);
                gtk_widget_set_sensitive (um->strength_indicator_label, FALSE);
                gtk_widget_set_sensitive (um->show_password_button, FALSE);
                gtk_widget_set_sensitive (um->ok_button, TRUE);
        }
}
static void
on_selection_changed (InfGtkBrowserView              *browser_view,
                      GtkTreeIter                    *iter,
                      GeditCollaborationWindowHelper *helper)
{
	update_sensitivity (helper);
}
static void
action_changed (GtkComboBox      *combo,
                UmPasswordDialog *um)
{
        gint active;

        active = gtk_combo_box_get_active (combo);
        if (active == 0) {
                gtk_widget_set_sensitive (um->password_entry, TRUE);
                gtk_widget_set_sensitive (um->generate_button, TRUE);
                gtk_widget_set_has_tooltip (um->generate_button, TRUE);
                gtk_widget_set_sensitive (um->verify_entry, TRUE);
                gtk_widget_set_sensitive (um->old_password_entry, TRUE);
                gtk_widget_set_sensitive (um->normal_hint_entry, TRUE);
                gtk_widget_set_sensitive (um->normal_hint_label, TRUE);
                gtk_widget_set_sensitive (um->strength_indicator_label, TRUE);
                gtk_widget_set_sensitive (um->show_password_button, TRUE);

                update_sensitivity (um);
        }
        else {
                gtk_widget_set_sensitive (um->password_entry, FALSE);
                gtk_widget_set_sensitive (um->generate_button, FALSE);
                gtk_widget_set_has_tooltip (um->generate_button, FALSE);
                gtk_widget_set_sensitive (um->verify_entry, FALSE);
                gtk_widget_set_sensitive (um->old_password_entry, FALSE);
                gtk_widget_set_sensitive (um->normal_hint_entry, FALSE);
                gtk_widget_set_sensitive (um->normal_hint_label, FALSE);
                gtk_widget_set_sensitive (um->strength_indicator_label, FALSE);
                gtk_widget_set_sensitive (um->show_password_button, FALSE);
                gtk_widget_set_sensitive (um->ok_button, TRUE);
        }
}
Esempio n. 10
0
gboolean
on_clist_nodes_button_press_event(GtkWidget *unused_widget,
		GdkEventButton *event, gpointer unused_udata)
{
    gint row;
    gint col;
    GtkCList *clist_nodes = GTK_CLIST
        (gui_main_window_lookup("clist_nodes"));

	(void) unused_widget;
	(void) unused_udata;

    if (event->button != 3)
		return FALSE;

	update_sensitivity(clist_nodes->selection != NULL);

    if (
		!gtk_clist_get_selection_info(clist_nodes,
			event->x, event->y, &row, &col)
	)
		return FALSE;

    gtk_menu_popup(GTK_MENU(gui_popup_nodes()), NULL, NULL, NULL, NULL,
        event->button, event->time);

	return TRUE;
}
Esempio n. 11
0
void
on_volume_combo_changed(GtkWidget* w, gpointer user_data)
{
	FormatDialog* dialog = g_object_get_data( G_OBJECT(gtk_widget_get_toplevel(w)), "userdata" );
	update_extra_info(dialog);
	update_options_visibility(dialog);
	update_sensitivity(dialog);
}
Esempio n. 12
0
static void
update_dialog(FormatDialog* dialog)
{
	rebuild_volume_combo(dialog);
	update_extra_info(dialog);
	update_options_visibility(dialog);
	update_sensitivity(dialog);
}
Esempio n. 13
0
static void
merge_mode_changed(GtkWidget *combo, MergeControls *controls)
{
    MergeArgs *args = controls->args;
    args->mode = gwy_enum_combo_box_get_active(GTK_COMBO_BOX(combo));
    gwy_data_chooser_refilter(GWY_DATA_CHOOSER(controls->op2));
    update_sensitivity(controls);
}
static void
password_entry_changed (GtkEntry         *entry,
                        GParamSpec       *pspec,
                        UmPasswordDialog *um)
{
        update_password_strength (um);
        update_sensitivity (um);
}
Esempio n. 15
0
static void
load_file_list (DialogData *data)
{
	update_sensitivity (data);
	if (_g_file_equal (data->source, data->last_source))
		return;
	cancel (data, list_source_files);
}
static void
old_password_entry_changed (GtkEntry         *entry,
                            GParamSpec       *pspec,
                            UmPasswordDialog *um)
{
        clear_entry_validation_error (GTK_ENTRY (entry));
        um->old_password_ok = FALSE;
        update_sensitivity (um);
}
Esempio n. 17
0
void
pad_area_changed_callback (PadArea *area)
{
  update_sensitivity ();
  if(area->auto_look_up)
    {
      look_up_callback (NULL);
    }
}
Esempio n. 18
0
static void
mode_changed(GtkToggleButton *toggle, EntropyControls *controls)
{
    if (!gtk_toggle_button_get_active(toggle))
        return;

    controls->args->mode = gwy_radio_buttons_get_current(controls->mode);
    update_sensitivity(controls);
}
static void
verify_entry_changed (GtkEntry         *entry,
                      GParamSpec       *pspec,
                      UmPasswordDialog *um)
{
        clear_entry_validation_error (GTK_ENTRY (entry));
        update_password_strength (um);
        update_sensitivity (um);
}
Esempio n. 20
0
static void
update_regex (IdeTerminalSearch *self)
{
  const char *search_text;
  gboolean caseless;
  g_autofree gchar *pattern = NULL;
  g_autoptr(GError) error = NULL;

  g_assert (IDE_IS_TERMINAL_SEARCH (self));

  search_text = gtk_entry_get_text (GTK_ENTRY (self->search_entry));
  caseless = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->match_case_checkbutton));

  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->regex_checkbutton)))
    pattern = g_strdup (search_text);
  else
    pattern = g_regex_escape_string (search_text, -1);

  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->entire_word_checkbutton)))
    {
      char *new_pattern;
      new_pattern = g_strdup_printf ("\\b%s\\b", pattern);
      g_free (pattern);
      pattern = new_pattern;
    }

  if (self->regex_caseless == caseless &&
      g_strcmp0 (self->regex_pattern, pattern) == 0)
    return;

  if (self->regex)
    {
      vte_regex_unref (self->regex);
    }

  g_clear_pointer (&self->regex_pattern, g_free);

  if (search_text[0] != '\0')
    {
      guint32 compile_flags;

      compile_flags = PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_MULTILINE;
      if (caseless)
        compile_flags |= PCRE2_CASELESS;

      self->regex = vte_regex_new_for_search (pattern, -1, compile_flags, &error);

      if (self->regex != NULL)
        self->regex_pattern = g_steal_pointer (&pattern);
    }
  else
    self->regex = NULL;

  update_sensitivity (self);

  g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_REGEX]);
}
Esempio n. 21
0
void
on_clist_nodes_unselect_row(GtkCList *clist, gint unused_row,
		gint unused_col, GdkEvent *unused_event, gpointer unused_udata)
{
	(void) unused_row;
	(void) unused_col;
	(void) unused_event;
	(void) unused_udata;

	update_sensitivity(clist->selection != NULL);
}
static gboolean
password_entry_timeout (UmPasswordDialog *um)
{
        update_password_strength (um);
        update_sensitivity (um);
        update_password_match (um);

        um->password_entry_timeout_id = 0;

        return FALSE;
}
static void
connection_editor_validate (NMConnectionEditor *editor)
{
	NMSettingConnection *s_con;
	GSList *iter;
	gs_free char *validation_error = NULL;
	GError *error = NULL;

	if (!editor_is_initialized (editor)) {
		validation_error = g_strdup (_("Editor initializing…"));
		goto done_silent;
	}

	s_con = nm_connection_get_setting_connection (editor->connection);
	g_assert (s_con);
	if (nm_setting_connection_get_read_only (s_con)) {
		validation_error = g_strdup (_("Connection cannot be modified"));
		goto done;
	}

	if (!ui_to_setting (editor, &error)) {
		validation_error = g_strdup (error->message);
		g_clear_error (&error);
		goto done;
	}

	for (iter = editor->pages; iter; iter = g_slist_next (iter)) {
		if (!ce_page_validate (CE_PAGE (iter->data), editor->connection, &error)) {
			if (!validation_error) {
				validation_error = g_strdup_printf (_("Invalid setting %s: %s"),
				                                    CE_PAGE (iter->data)->title,
				                                    error->message);
			}
			g_clear_error (&error);
		}
	}

done:
	if (g_strcmp0 (validation_error, editor->last_validation_error) != 0) {
		if (editor->last_validation_error && !validation_error)
			g_message ("Connection validates and can be saved");
		else if (validation_error)
			g_message ("Cannot save connection due to error: %s", validation_error);
		g_free (editor->last_validation_error);
		editor->last_validation_error = g_strdup (validation_error);
	}

done_silent:
	ce_polkit_button_set_validation_error (CE_POLKIT_BUTTON (editor->ok_button), validation_error);
	gtk_widget_set_sensitive (editor->export_button, !validation_error);

	update_sensitivity (editor);
}
Esempio n. 24
0
static void
karea_primary_clear (GtkClipboard *clipboard,
		     gpointer      owner)
{
  GtkWidget *w = owner;
  
  karea_erase_selection (w);
  kselected.d[0] = kselected.d[1] = 0;

  update_sensitivity ();
  gtk_widget_queue_draw (w);
}
static void
reload_settings (void)
{
        MateWMSettings new_settings;

        g_assert (n_mouse_modifiers > 0);

        if (current_wm != NULL) {
                new_settings.flags = MATE_WM_SETTING_MOUSE_FOCUS |
                        MATE_WM_SETTING_AUTORAISE |
                        MATE_WM_SETTING_AUTORAISE_DELAY |
                        MATE_WM_SETTING_MOUSE_MOVE_MODIFIER |
                        MATE_WM_SETTING_DOUBLE_CLICK_ACTION;

                /* this will clear any flags that don't get filled in */
                mate_window_manager_get_settings (current_wm, &new_settings);
        } else {
                new_settings.flags = 0;
        }

        init_settings_struct (&new_settings);

        if (new_settings.focus_follows_mouse != settings->focus_follows_mouse)
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (focus_mode_checkbutton),
                                              new_settings.focus_follows_mouse);

        if (new_settings.autoraise != settings->autoraise)
                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (autoraise_checkbutton),
                                              new_settings.autoraise);

        if (new_settings.autoraise_delay != settings->autoraise_delay)
                gtk_range_set_value (GTK_RANGE (autoraise_delay_slider),
                                     new_settings.autoraise_delay / 1000.0);

        if (n_double_click_actions > 0 &&
            new_settings.double_click_action != settings->double_click_action) {
                gtk_combo_box_set_active (GTK_COMBO_BOX (double_click_titlebar_optionmenu),
                                             new_settings.double_click_action);
        }

        if (settings->mouse_move_modifier == NULL ||
            new_settings.mouse_move_modifier == NULL ||
            strcmp (settings->mouse_move_modifier,
                    new_settings.mouse_move_modifier) != 0) {
                set_alt_click_value (&new_settings);
        }

	mate_wm_settings_free (settings);
        settings = mate_wm_settings_copy (&new_settings);

        update_sensitivity ();
}
static void
auth_cb (PasswdHandler    *handler,
         GError           *error,
         UmPasswordDialog *um)
{
        if (error) {
                um->old_password_ok = FALSE;
        }
        else {
                um->old_password_ok = TRUE;
                set_entry_validation_checkmark (GTK_ENTRY (um->old_password_entry));
        }

        update_sensitivity (um);
}
Esempio n. 27
0
/* This function is used in GtkMenuToolButton, the call back will
 * be called when GtkMenuToolButton would have emitted the “show-menu”
 * signal.
 */
void
_gtk_menu_button_set_popup_with_func (GtkMenuButton                 *menu_button,
                                      GtkWidget                     *menu,
                                      GtkMenuButtonShowMenuCallback  func,
                                      gpointer                       user_data)
{
  GtkMenuButtonPrivate *priv;

  g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
  g_return_if_fail (GTK_IS_MENU (menu) || menu == NULL);

  priv = menu_button->priv;
  priv->func = func;
  priv->user_data = user_data;

  if (priv->menu == GTK_WIDGET (menu))
    return;

  if (priv->menu)
    {
      if (gtk_widget_get_visible (priv->menu))
        gtk_menu_shell_deactivate (GTK_MENU_SHELL (priv->menu));

      g_signal_handlers_disconnect_by_func (priv->menu,
                                            menu_deactivate_cb,
                                            menu_button);
      gtk_menu_detach (GTK_MENU (priv->menu));
    }

  priv->menu = menu;

  if (priv->menu)
    {
      gtk_menu_attach_to_widget (GTK_MENU (priv->menu), GTK_WIDGET (menu_button),
                                 menu_detacher);

      gtk_widget_set_visible (priv->menu, FALSE);

      g_signal_connect_swapped (priv->menu, "deactivate",
                                G_CALLBACK (menu_deactivate_cb), menu_button);
      gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (menu_button)), "menu-button");
    }

  update_sensitivity (menu_button);

  g_object_notify (G_OBJECT (menu_button), "popup");
  g_object_notify (G_OBJECT (menu_button), "menu-model");
}
static gboolean
old_password_entry_timeout (UmPasswordDialog *um)
{
        const char *text;

        update_sensitivity (um);

        text = gtk_entry_get_text (GTK_ENTRY (um->old_password_entry));
        if (strlen (text) > 0 && !um->old_password_ok) {
                passwd_authenticate (um->passwd_handler, text, (PasswdCallback)auth_cb, um);
        }

        um->old_password_entry_timeout_id = 0;

        return FALSE;
}
Esempio n. 29
0
void Gobby::FindDialog::on_document_changed(SessionView* view)
{
	m_active_user_changed_connection.disconnect();
	TextSessionView* text_view = dynamic_cast<TextSessionView*>(view);

	if(text_view != NULL)
	{
		m_active_user_changed_connection =
			text_view->signal_active_user_changed().connect(
				sigc::mem_fun(
					*this,
					&FindDialog::on_active_user_changed));
	}

	update_sensitivity();
}
static void
on_browser_status_changed (InfcBrowser                    *browser,
                           GParamSpec                     *spec,
                           GeditCollaborationWindowHelper *helper)
{
	update_sensitivity (helper);

	if (infc_browser_get_status (browser) == INFC_BROWSER_CONNECTED)
	{
		request_chat (browser, helper);
	}
	else if (infc_browser_get_status (browser) == INFC_BROWSER_DISCONNECTED)
	{
		remove_chat (browser, helper);
	}
}