/*
*
* ProLinga-Run
*
* Copyright (C) 2002-2008 Xobas Software.
* All rights reserved.
*
* This file is part of ProLinga-Run.
*
* ProLinga-Run is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProLinga-Run is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProLinga-Run. If not, see .
*
* More information is available at the following addresses:
*
* Website : http://www.prolinga.org
*
* Email : prolinga-list@prolinga.org
*
*
*/
#include "RunCommon.h"
#include
#include
#include
#include
#include
#include "RunShare.hpp"
#include "RepositoryCommand.hpp"
#include "DataRef.hpp"
#include "Limits.hpp"
#include "Widget.hpp"
/* Command : MESSAGE */
/* Syntax : MESSAGE data_ref [data_ref...] */
void CmdMessage(char **argList, int argHits, bool isMainThread, GtkWidget *outputScreen)
{
GladeXML *xml;
GList *wdgList;
GtkWidget *curWdg;
int i, lengthWdgList;
char messageString[LM_STATUS_MESSAGE_LENGTH] = {'\0'}, returnRef[LM_STATUS_MESSAGE_LENGTH];
/* If no active screen return */
if (outputScreen == NULL)
return;
/* Concatenate 1 big string from arguments */
for (i = 1; i <= argHits; i++)
{
getDataRefRaw(argList[i], isMainThread, returnRef, false);
if (i == 1)
strcpy(messageString, returnRef);
else
strcat(messageString, returnRef);
}
/* get GTK thread lock */
if (isMainThread == false)
gdk_threads_enter();
/* Get list of widgets and find status bar */
xml = glade_get_widget_tree(outputScreen);
wdgList = glade_xml_get_widget_prefix(xml, "");
lengthWdgList = g_list_length(wdgList);
for (i = 1; i < lengthWdgList; i++)
{
curWdg = GTK_WIDGET(g_list_nth_data(wdgList, i));
if (strcmp(G_OBJECT_TYPE_NAME(G_OBJECT(curWdg)), WDG_STATUSBAR) == 0)
{
/* Work Around to clear status bar */
gtk_statusbar_pop(GTK_STATUSBAR(curWdg),1);
gtk_statusbar_push(GTK_STATUSBAR(curWdg), 1, messageString);
}
}
if (isMainThread == false)
{
/* Sync with X server */
gdk_flush();
/* release GTK thread lock */
gdk_threads_leave();
}
}