Beispiel #1
0
gint gw_status_bar_put_messages ( GtkWindow *w, gchar *first_msg, gchar *second_msg)
{
    GtkStatusbar *status = NULL;
    guint context_id;
    gint result = -1;
    /* They are static in order to remove last messages before put new messages. */
    static guint message_id1 = 0;
    static guint message_id2 = 0;
    gchar *text_utf8 = NULL;


#ifdef GW_DEBUG_GUI_COMPONENT
    g_print ( "*** GW - %s (%d) :: %s() : (%s;%s)\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, first_msg, second_msg);
#endif

    if ( w != NULL )
    {
        if ( first_msg != NULL )
        {
            status = gw_status_bar_get_first_status ( w);
            context_id = gtk_statusbar_get_context_id ( status, "Working");
            if ( message_id1 != 0 )
            {
                gtk_statusbar_remove ( status, context_id, message_id1);
            }
            g_strdup_to_gtk_text ( first_msg, text_utf8);
            message_id1 = gtk_statusbar_push ( status, context_id, text_utf8);
            g_free ( text_utf8);
        }

        if ( second_msg != NULL )
        {
            status = gw_status_bar_get_second_status ( w);
            context_id = gtk_statusbar_get_context_id ( status, "Working");
            if ( message_id2 != 0 )
            {
                gtk_statusbar_remove ( status, context_id, message_id2);
            }
            g_strdup_to_gtk_text ( second_msg, text_utf8);
            message_id2 = gtk_statusbar_push ( status, context_id, text_utf8);
            g_free ( text_utf8);
        }

        result = 0;
    }

    return result;
}
Beispiel #2
0
int update_statusbar() {
  int i, j;
  char *options[128];
  guint context_id;
  GtkStatusbar *statusbar;
  extern guint message_id;
  GString *statustext = g_string_new("hydra ");

  i = hydra_get_options(options);

  for (j = 1; j < i; j++) {

    statustext = g_string_append(statustext, options[j]);
    statustext = g_string_append_c(statustext, ' ');
  }

  statusbar = (GtkStatusbar *) lookup_widget(GTK_WIDGET(wndMain), "statusbar");
  context_id = gtk_statusbar_get_context_id(statusbar, "status");

  /* an old message in stack? */
  if (message_id != 0) {
    gtk_statusbar_remove(statusbar, context_id, message_id);
  }

  message_id = gtk_statusbar_push(statusbar, context_id, (gchar *) statustext->str);

  (void) g_string_free(statustext, TRUE);

  return TRUE;
}
Beispiel #3
0
static void
notifications_update(void *opaque, prop_event_t event, ...)
{
  statusbar_t *sb = opaque;
  prop_t *p, *txt;
  statusbar_entry_t *sbe;
  char *buf;
  rstr_t *msg;
  int i, l;
  va_list ap;
  va_start(ap, event);

  switch(event) {
  case PROP_ADD_CHILD:
    p = va_arg(ap, prop_t *);

    txt = prop_get_by_name(PNVEC("self", "text"), 1,
			   PROP_TAG_NAMED_ROOT, p, "self",
			   NULL);
    if(txt != NULL) {
      msg = prop_get_string(txt);

      if(msg != NULL) {
	buf = mystrdupa(rstr_get(msg));
	l = strlen(buf);
	for(i = 0; i < l; i++)
	  if(buf[i] < ' ')
	    buf[i] = ' ';

	sbe = calloc(1, sizeof(statusbar_entry_t));
	sbe->p = prop_ref_inc(p);
	sbe->id = gtk_statusbar_push(GTK_STATUSBAR(sb->bar), sb->ctxid, buf);
	LIST_INSERT_HEAD(&sb->entries, sbe, link);
	rstr_release(msg);
      }
      prop_ref_dec(txt);
    }
    break;

  case PROP_DEL_CHILD:
    p = va_arg(ap, prop_t *);

    LIST_FOREACH(sbe, &sb->entries, link)
      if(sbe->p == p)
	break;

    if(sbe == NULL)
      break;

    prop_ref_dec(sbe->p);
    gtk_statusbar_remove(GTK_STATUSBAR(sb->bar), sb->ctxid, sbe->id);
    LIST_REMOVE(sbe, link);
    free(sbe);
    break;

  default:
    break;
  }
}
void
statusbar_clear_status(StatusBar_t *statusbar)
{
   if (statusbar->message_id)
      gtk_statusbar_remove(GTK_STATUSBAR(statusbar->status),
                           statusbar->status_id,
                           statusbar->message_id);
}
Beispiel #5
0
/*
 * Timeout callbacks for statusbar_push_temporary_msg
 */
static gboolean
statusbar_remove_temporary_msg(gpointer data)
{
    guint msg_id = GPOINTER_TO_UINT(data);

    gtk_statusbar_remove(GTK_STATUSBAR(info_bar), main_ctx, msg_id);

    return FALSE;
}
Beispiel #6
0
/* cvs_task_set_status */
static void _cvs_task_set_status(CVSTask * task, char const * status)
{
	GtkStatusbar * sb = GTK_STATUSBAR(task->statusbar);

	if(task->statusbar_id != 0)
		gtk_statusbar_remove(sb, gtk_statusbar_get_context_id(sb, ""),
				task->statusbar_id);
	task->statusbar_id = gtk_statusbar_push(sb,
			gtk_statusbar_get_context_id(sb, ""), status);
}
Beispiel #7
0
/**
 * gva_main_statusbar_remove:
 * @context_id: a context identifier
 * @message_id: a message identifier
 *
 * Thin wrapper for gtk_statusbar_remove() that uses the main window's
 * status bar.
 *
 * Forces the removal of a message from a status bar's stack.  The exact
 * @context_id and @message_id must be specified.
 **/
void
gva_main_statusbar_remove (guint context_id,
                           guint message_id)
{
        GtkStatusbar *statusbar;

        statusbar = GTK_STATUSBAR (GVA_WIDGET_MAIN_STATUSBAR);

        gtk_statusbar_remove (statusbar, context_id, message_id);
}
Beispiel #8
0
void *_refresh_thr(gpointer arg)
{
	int msg_id = GPOINTER_TO_INT(arg);
	sleep(5);
	gdk_threads_enter();
	gtk_statusbar_remove(GTK_STATUSBAR(main_statusbar),
			     STATUS_REFRESH, msg_id);
	//gdk_flush();
	gdk_threads_leave();
	return NULL;
}
Beispiel #9
0
static void explorer_update_status_bar(Explorer *self)
{
    gchar *status = explorer_strdup_status(self);

    if (self->render_status_message_id)
	gtk_statusbar_remove(self->statusbar, self->render_status_context, self->render_status_message_id);

    self->render_status_message_id = gtk_statusbar_push(self->statusbar, self->render_status_context, status);
    g_free(status);

    self->status_dirty_flag = FALSE;
}
Beispiel #10
0
void ctk_statusbar_clear(CtkStatusBar *status_bar)
{
    if ((!status_bar->enabled) ||
        (!status_bar->widget)) {
        return;
    }

    if (status_bar->prev_message_id) {
        gtk_statusbar_remove(GTK_STATUSBAR(status_bar->widget),
                             1, status_bar->prev_message_id);
    }
}
Beispiel #11
0
static int 
gm_statusbar_clear_msg_cb (gpointer data)
{
  gint id = 0;
  
  g_return_val_if_fail (data != NULL, FALSE);
  
  id = gtk_statusbar_get_context_id (GTK_STATUSBAR (object), "statusbar");
  gtk_statusbar_remove (GTK_STATUSBAR (object), id, GPOINTER_TO_INT (data));

  return FALSE;
}
Beispiel #12
0
static void
on_diagram_changed (LdDiagram *diagram, LdWindowMain *self)
{
	update_title (self);

	if (self->priv->statusbar_hint_drag)
	{
		gtk_statusbar_remove (GTK_STATUSBAR (self->priv->statusbar),
			self->priv->statusbar_hint_context_id,
			self->priv->statusbar_hint_drag);
		self->priv->statusbar_hint_drag = 0;
	}
}
Beispiel #13
0
static int
gm_statusbar_clear_msg_cb (gpointer data)
{
  GtkStatusbar* statusbar = ((callback_info*)data)->statusbar;
  gint msg_id = ((callback_info*)data)->msg_id;
  gint id = 0;

  id = gtk_statusbar_get_context_id (statusbar, "statusbar");
  gtk_statusbar_remove (statusbar, id, msg_id);

  /*  g_free (data); yes, it's tempting, but we have a destroy notifier which will do it */

  return FALSE;
}
Beispiel #14
0
/**
 * Clear any message in the status bar.
 */
void gsb_status_clear (  )
{
    if ( ! main_statusbar || ! GTK_IS_STATUSBAR ( main_statusbar ) )
	return;

    if ( message_id >= 0 )
    {
	gtk_statusbar_remove ( GTK_STATUSBAR (main_statusbar), context_id, message_id );
	message_id = -1;
    }

    /* force status message to be displayed NOW */
    update_gui ( );
}
Beispiel #15
0
void ctk_statusbar_message(CtkStatusBar *status_bar,
                           const gchar *str)
{

    if ((!status_bar->enabled) ||
        (!status_bar->widget)) {
        return;
    }

    if (status_bar->prev_message_id) {
        gtk_statusbar_remove(GTK_STATUSBAR(status_bar->widget),
                             1, status_bar->prev_message_id);
    }

    status_bar->prev_message_id =
        gtk_statusbar_push
        (GTK_STATUSBAR(status_bar->widget), 1, str);

} /* ctk_config_statusbar_message() */
Beispiel #16
0
void	printMapStatBar( const char *s, ... )
{
	static char	str[SCREEN_WIDTH * CHAR_MAX_LEN_UTF_8 + 1];
	const long	max_len = SCREEN_WIDTH * CHAR_MAX_LEN_UTF_8;
	va_list	argptr;

	va_start( argptr, s );
	vsn_printf( str, max_len, s, argptr );
	va_end( argptr );

	gtk_statusbar_remove(
			GTK_STATUSBAR( statBarMap ),
			statBarMapContextId,
			statBarMapMesId );

	statBarMapMesId = gtk_statusbar_push(
			GTK_STATUSBAR( statBarMap ),
			statBarMapContextId,
			str );
}
Beispiel #17
0
/**
 * gwy_statusbar_set_markup:
 * @statusbar: A statusbar.
 * @markup: Text message to display in the statusbar.  It can contain Pango
 *          markup.
 *
 * Sets the text to display in a status bar.
 *
 * This method is intended for simple status bars that do not have stacks and
 * do not need contexts.  It does not mix with gtk_status_bar_push().  You can
 * use either this simple interface or the full stacks-and-contexts API with
 * #GwyStatusbar, but not both in the same status bar.
 **/
void
gwy_statusbar_set_markup(GwyStatusbar *statusbar,
                         const gchar *markup)
{
    GtkStatusbar *sbar;
    guint id;

    sbar = GTK_STATUSBAR(statusbar);
    if (!statusbar->context_id) {
        if (sbar->keys)
            g_warning("gwy_statusbar_set_markup() does not mix with "
                      "full stacks-and-context GwyStatusbar API");
        statusbar->context_id
            = gtk_statusbar_get_context_id(sbar, "GwyStatusbar-global-context");
    }

    id = gtk_statusbar_push(sbar, statusbar->context_id, markup);
    if (statusbar->message_id)
        gtk_statusbar_remove(sbar, statusbar->context_id,
                             statusbar->message_id);
    statusbar->message_id = id;
}
Beispiel #18
0
static void display_status_bar_toggled(
    GtkWidget *widget,
    gpointer user_data
)
{
    CtkConfig *ctk_config = CTK_CONFIG(user_data);

    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
        gtk_widget_show(ctk_config->status_bar.widget);
        ctk_config->conf->booleans |= CONFIG_PROPERTIES_DISPLAY_STATUS_BAR;
        ctk_config_statusbar_message(ctk_config, "Status bar enabled.");
    } else {
        gtk_widget_hide(ctk_config->status_bar.widget);

        if (ctk_config->status_bar.prev_message_id) {
            gtk_statusbar_remove(GTK_STATUSBAR(ctk_config->status_bar.widget),
                                 1, ctk_config->status_bar.prev_message_id);
        }
    
        ctk_config->status_bar.prev_message_id = 0;

        ctk_config->conf->booleans &= ~CONFIG_PROPERTIES_DISPLAY_STATUS_BAR;
    }
}
Beispiel #19
0
/*
 *delete_hint
 * deletes the menu hint from the statusbar, and set widget state to normal
*/
static gboolean delete_hint(GtkWidget *widget, GdkEventCrossing *event, gpointer user_data){
    MainWindow *main_window = (MainWindow *) user_data;
    gtk_widget_set_state (widget, GTK_STATE_NORMAL);
    gtk_statusbar_remove (GTK_STATUSBAR(main_window->appbar), main_window->context_id, main_window->message_id);
    return FALSE;
}
Beispiel #20
0
void
statusbar_gui_remove(statusbar_msgid_t id)
{
    gtk_statusbar_remove(statusbar_get(), id.scid, id.msgid);
}